Adding Database entity, API refactoring