refactoring entity creation.