HACKLOG-2 Migrating database logic to sync with ORM management in entities file