diff --git a/uSync8.Core/Serialization/Serializers/ContentTypeBaseSerializer.cs b/uSync8.Core/Serialization/Serializers/ContentTypeBaseSerializer.cs index 2c105c2f..8b9e78e4 100644 --- a/uSync8.Core/Serialization/Serializers/ContentTypeBaseSerializer.cs +++ b/uSync8.Core/Serialization/Serializers/ContentTypeBaseSerializer.cs @@ -115,16 +115,18 @@ protected virtual void SerializeExtraProperties(XElement node, TObject item, Pro protected XElement SerializeStructure(TObject item) { var node = new XElement("Structure"); - - foreach (var allowedType in item.AllowedContentTypes.OrderBy(x => x.Alias)) + List> items = new List>(); + + foreach (var allowedType in item.AllowedContentTypes) { var allowedItem = FindItem(allowedType.Id.Value); if (allowedItem != null) { - node.Add(new XElement(ItemType, new XAttribute("Key", allowedItem.Key.ToString()), allowedItem.Alias)); + items.Add(new KeyValuePair(allowedItem.Key.ToString(), allowedItem.Alias)); } } - + if (items.Count > 0) + node.Add(items.OrderBy(x => x.Value).Select(x => new XElement(ItemType, new XAttribute("Key", x.Key), x.Value)).ToArray()); return node; }