for (String name : ourChanges.getRemovedProperties().keySet()) {
stagedNode.getProperties().remove(name);
}
for (Map.Entry<String, NodeState> entry : ourChanges.getAddedChildNodes().entrySet()) {
MongoNodeState nodeState = (MongoNodeState)entry.getValue();
stagedNode.addChildNodeEntry(nodeState.unwrap());
}
for (Map.Entry<String, NodeState> entry : ourChanges.getChangedChildNodes().entrySet()) {
if (!theirChanges.getChangedChildNodes().containsKey(entry.getKey())) {
MongoNodeState nodeState = (MongoNodeState)entry.getValue();
stagedNode.addChildNodeEntry(nodeState.unwrap());
}
}
for (String name : ourChanges.getRemovedChildNodes().keySet()) {
stagedNode.removeChildNodeEntry(name);
}