Refactoring Api struct entity related function to put it together with the entity