private static EntityDefinition CreateEntityDefinition( XElement element, EntityDefinition baseEntity = null, ExtendedKeyedCollection <string, PropertyDefinition> properties = null, ExtendedKeyedCollection <string, Variable> variables = null) { string name = element.GetAttributeValueOrThrow(AttributeNames.Name); if (baseEntity != null && properties != null) { foreach (PropertyDefinition property in properties) { if (baseEntity.FindProperty(property.Name) != null) { ThrowInvalidOperation(ErrorMessages.PropertyAlreadyDefined(property.Name, name), element); } } } return(new EntityDefinition(name, baseEntity ?? EntityDefinition.Global, properties, variables)); }