private static UpdateAction <ManageableUnstructuredMarketDataSnapshot> PrepareUpdateFrom(MarketDataValueSpecification currSpec, IDictionary <string, ValueSnapshot> currValues, MarketDataValueSpecification newSpec, IDictionary <string, ValueSnapshot> newValues) { var actions = currValues.ProjectStructure(newValues, (k, a, b) => { var newMarketValue = b.MarketValue; return(new UpdateAction <ManageableUnstructuredMarketDataSnapshot>(delegate(ManageableUnstructuredMarketDataSnapshot s) { s._values[currSpec][k].MarketValue = newMarketValue; })); }, (k, v) => PrepareRemoveAction(currSpec, k, v), (k, v) => { var valueSnapshot = v.Clone(); return(new UpdateAction <ManageableUnstructuredMarketDataSnapshot>( delegate(ManageableUnstructuredMarketDataSnapshot s) { s._values[currSpec].Add(k, valueSnapshot.Clone()); s.InvokePropertyChanged("Values"); })); }); UpdateAction <ManageableUnstructuredMarketDataSnapshot> ret = UpdateAction <ManageableUnstructuredMarketDataSnapshot> .Create(actions); if (!currSpec.Equals(newSpec)) {//we need to update the key, since we used a non standard comparer ret = ret.Concat( new UpdateAction <ManageableUnstructuredMarketDataSnapshot>(delegate(ManageableUnstructuredMarketDataSnapshot s) { var prevValue = s._values[currSpec]; s.Values[newSpec] = prevValue; s._values.Remove(currSpec); s.InvokePropertyChanged("Values"); }) ); } return(ret); }