public void SetCategoryProperty(dataModel.Category category, dataModel.Property property) { if (category.PropertySet == null) { var propertySet = new dataModel.PropertySet { Name = category.Name + " property set", TargetType = "Category" }; Add(propertySet); category.PropertySetId = propertySet.Id; } var propertySetProperty = new dataModel.PropertySetProperty { PropertySetId = category.PropertySetId, PropertyId = property.Id }; Add(propertySetProperty); }