private ImmutableList <Product> MergeProducts(Subset subset, string name, ImmutableList <Product> childProducts, ImmutableList <Product> products) { var mergedProducts = from product in products let matchingChildProducts = ( from childProduct in childProducts where subset.Of(childProduct).Equals(subset.Of(product)) select childProduct ).ToImmutableList() select product.With(name, new CollectionElement(matchingChildProducts)); return(mergedProducts.ToImmutableList()); }