private void buildCalculationMethodCombinationTree(string compoundName, CalculationMethodCache configurationCache, TreeItem <CalculationMethodWithCompoundName> treeRoot) { var categoryCache = new Cache <string, IEnumerable <CalculationMethodWithCompoundName> >(); configurationCache.GroupBy(method => method.Category).Each(grouping => { categoryCache[grouping.Key] = grouping.Select(method => new CalculationMethodWithCompoundName(method, compoundName)).ToList(); }); categoryCache.Keys.Each(key => treeRoot.AddToAllLeaves(categoryCache[key])); }