public virtual Property ToModel(Property property) { if (property == null) { throw new ArgumentNullException(nameof(property)); } property.Id = Id; property.CreatedBy = CreatedBy; property.CreatedDate = CreatedDate; property.ModifiedBy = ModifiedBy; property.ModifiedDate = ModifiedDate; property.CatalogId = CatalogId; property.CategoryId = CategoryId; property.Name = Name; property.Required = IsRequired; property.Multivalue = IsMultiValue; property.Multilanguage = IsLocaleDependant; property.Dictionary = IsEnum; property.Hidden = IsHidden; property.ValueType = (PropertyValueType)PropertyValueType; property.Type = EnumUtility.SafeParse(TargetType, PropertyType.Catalog); property.Attributes = PropertyAttributes.Select(x => x.ToModel(AbstractTypeFactory <PropertyAttribute> .TryCreateInstance())).ToList(); property.DisplayNames = DisplayNames.Select(x => x.ToModel(AbstractTypeFactory <PropertyDisplayName> .TryCreateInstance())).ToList(); property.ValidationRules = ValidationRules.Select(x => x.ToModel(AbstractTypeFactory <PropertyValidationRule> .TryCreateInstance())).ToList(); foreach (var rule in property.ValidationRules) { rule.Property = property; } return(property); }