public void OrderPropertiesGroups(MaterialDetailsModel model, IDictionary <ProductGroup.ProductGroupType, ProductGroup> listOfGroups) { ProductGroup orderedGroups = new ProductGroup(); IList <ProductGroup.ProductGroupType> list = orderedGroups.GetOrder(); foreach (var item in list) { if (listOfGroups.ContainsKey(item)) { model.Properties.ProductGroups.Add(item, listOfGroups[item]); } } }