Refactor the Entity Gateway into to implement db use cases internally