I'm making a comparing section, which I've just started typing, trying to get something working. It's working now, but as you can see its pretty messy.  I feel this could be done in one or two less queries, or I should break it apart into smaller methods.foreach (XMLObject source in Sources){    var matchedElement =        destList.FirstOrDefault(s.ElementName == source.ElementName);        // checks to see if it exists in one list but not the other    if (matchedElement == null) // element is in one list and not the other    {        var alter =            lstAlteration.FirstOrDefault(                a => a.ElementName == source.ElementName && a.ChangeInfo.ChangeFrom == source.ElementName);            // check to see if the the element is a Removal (Changed From would not be blank)        if (alter == null) // Removal has not been triggered        {            alter = new Alteration                        {                            ElementName = source.ElementName,                            ChangeInfo = new ChangeDetail( {ChangeTo = source.ElementName}                        };        }        else        {            alter.ChangeInfo.ChangeTo = source.ElementName;        }        lstAlteration.Add(alter);    }}
Comparison application
c#
foreach (var source in Sources.Where(x => !destList.Exists(s => s.ElementName == x.ElementName)){    var alter = lstAlteration.FirstOrDefault(a => a.ElementName == source.ElementName                                 && a.ChangeInfo.ChangeFrom == source.ElementName);    if (alter == null) {        alter = new Alteration                    {                        ElementName = source.ElementName,                        ChangeInfo = new ChangeDetail()                    };        lstAlteration.Add(alter);    }    alter.ChangeInfo.ChangeTo = source.ElementName;}SorterOnly one .ChangeInfo.ChangeTo = source.ElementName; execution