public int? Save(string category, string name, string description = null, bool isSystem = false, int? fieldTypeId = 1, int order = 0, string foreignId = null, string helpText = null, int definedTypeId = 0 ) { DefinedTypeController controller = new DefinedTypeController( Service ); DefinedType definedType = null; if(definedTypeId > 0) { definedType = controller.GetById( definedTypeId ); if(definedType == null || definedType == default(DefinedType)) { return null; } } else { definedType = new DefinedType(); } definedType.IsSystem = isSystem; definedType.FieldTypeId = fieldTypeId; definedType.Order = order; //definedType.Category = category; definedType.Name = name; definedType.Description = description; definedType.ForeignId = foreignId; definedType.HelpText = helpText; if ( definedTypeId > 0 ) { definedType.ModifiedByPersonAliasId = Service.LoggedInPerson.PrimaryAliasId; controller.Update( definedType ); } else { definedType.CreatedByPersonAliasId = Service.LoggedInPerson.PrimaryAliasId; controller.Add( definedType ); } definedType = controller.GetByGuid( definedType.Guid ); return definedType.Id; }