entities refactor
refactor of Entity
moved model to api