private static PropertyType CreateAndAddPropertyTypeToDocumentType(string propertyAlias, ContentType documentType, DocumentTypePropertyAttribute propertyAttribute)
        {
            var dataTypeDefinition = DataTypeDefinition.GetDataTypeDefinition(propertyAttribute.DataTypeId);
            if (dataTypeDefinition == null)
                throw new DataTypeDefinitionUnknownException(propertyAttribute.DataTypeId);

            var propertyType = documentType.AddPropertyType(dataTypeDefinition, propertyAlias, propertyAttribute.Name);

            SetPropertyTypeMandatoryIfDifferent(propertyType, propertyAttribute.Mandatory);
            SetPropertyTypeValidationExpressionIfDifferent(propertyType, propertyAttribute.ValidationExpression);
            SetPropertyTypeSortOrderIfDifferent(propertyType, propertyAttribute.SortOrder);
            SetPropertyTypeDescriptionIfDifferent(propertyType, propertyAttribute.Description);
            SetPropertyTypeTabIfDifferent(documentType, propertyType, propertyAttribute.Tab);

            return propertyType;
        }
 private static void UpdateExistingProperty(PropertyType propertyType, DocumentTypePropertyAttribute propertyAttribute, ContentType documentType)
 {
     SetPropertyTypeNameIfDifferent(propertyType, propertyAttribute.Name);
     SetPropertyTypeDescriptionIfDifferent(propertyType, propertyAttribute.Description);
     SetPropertyTypeMandatoryIfDifferent(propertyType, propertyAttribute.Mandatory);
     SetPropertyTypeValidationExpressionIfDifferent(propertyType, propertyAttribute.ValidationExpression);
     SetPropertyTypeSortOrderIfDifferent(propertyType, propertyAttribute.SortOrder);
     SetPropertyTypeTabIfDifferent(documentType, propertyType, propertyAttribute.Tab);
 }