SegmentWriter writer = new SegmentWriter(store);
while (!parent.setHead(base, head)) {
RecordId newBase = parent.getHead();
NodeBuilder builder =
new SegmentNodeState(store, newBase).builder();
after.compareAgainstBaseState(before, new MergeDiff(builder));
NodeState state = builder.getNodeState();
RecordId newHead = writer.writeNode(state).getRecordId();
writer.flush();
base = newBase;