using System.Collections.Generic;
using MoreLinq.Extensions;
public static void Main()
List<Person> personList = new List<Person>();
personList.Add(new Person(1,1));
personList.Add(new Person(1,2));
personList.Add(new Person(2,1));
personList.Add(new Person(2,2));
personList.Add(new Person(2,3));
personList.Add(new Person(3,2));
personList.Add(new Person(3,1));
personList.Add(new Person(4,1));
personList.Add(new Person(4,2));
personList.Add(new Person(4,3));
personList.Add(new Person(5,3));
var productionsInitiativesBySkus = personList
.GroupBy(sk => sk.Sku, (sku, clusters) => new { Sku = sku, Clusters = clusters.OrderBy(x => x.ClusterId).Select(x => x.ClusterId).Distinct().ToList() })
var clusterPairs = productionsInitiativesBySkus
.Select(x => x.Clusters);
List<List<MultiplePerson>> list = new List<List<MultiplePerson>>();
productionsInitiativesBySkus
if (!list.Any(l => l.Any(l1 => l1.ClusterIds.Equals(x.Clusters))))
var good = productionsInitiativesBySkus.Where(y => y.Clusters.SequenceEqual(x.Clusters));
var multiplePerson = good.Select(g => new MultiplePerson { Sku = g.Sku, ClusterIds = g.Clusters }).ToList();
list.Add(multiplePerson);
Console.WriteLine(JsonConvert.SerializeObject(list));
public class MultiplePerson
public int Sku { get;set; }
public List<int> ClusterIds {get;set;}
public int Sku { get;set; }
public int ClusterId {get;set;}
public Person(int sku, int cluster)