EntityDefinition fully refactored