Currently no exceptions are handled by the repositories, such as ForeignKeyConstraint and DuplicateEntry. These should be handled by the database layer(repositories) and passed onto the caller in a framework independent way. Custom exceptions is a possible solution.