Added Database/Entity tests.
Added length() to entity errrorbag and missing unit tests.
Added custom error types for entities.
Added custom type toArray and toJSON for entity errors.