Linq
var ids = (from id in ed_ProjectClass.Values select Guid.Parse(id)).ToArray(); Entity.ProjectClassCollection.Where(p => ids.Contains(p.Id) == false).ToList() .ForEach(p => Entity.ProjectClassCollection.Remove(p)); ids.Where(p => Entity.ProjectClassCollection.Any(k => k.Id == p) == false).ToList() .ForEach(p => Entity.ProjectClassCollection.Add( this._iProjectClassContract.GetById(p)));