Further refactoring of entity creation.