using System.Collections.Generic;
List<SomeObject> objects = new List<SomeObject>();
objects = new List<SomeObject>()
{new SomeObject{Name = "Rando Object 1", Id = 5, ValuePairs = new List<KeyPair>()
{new KeyPair{Key = "TestKey1", Value = "TestValue1"}, new KeyPair{Key = "TestKey2", Value = "TestValue2"}}}, new SomeObject{Name = "Rando Object 2", Id = 5, ValuePairs = new List<KeyPair>()
{new KeyPair{Key = "TestKey3", Value = "TestValue3"}, new KeyPair{Key = "TestKey4", Value = "TestValue4"}}}};
public List<SomeObject> MergeObj(List<SomeObject> someObjects)
var idList = someObjects.Select(x => x.Id).Distinct().ToList();
var newSomeObjects = new List<SomeObject>();
var newValuePairList = new List<KeyPair>();
someObjects.Where(y => y.Id == x).ToList().ForEach(y =>
newValuePairList.AddRange(y.ValuePairs);
newSomeObjects.Add(new SomeObject{Id = x, ValuePairs = newValuePairList});
public List<KeyPair> ValuePairs