private NodeImpl copy(Node node) {
NodeImpl copy = new NodeImpl(node.getPath());
copy.setRevisionId(node.getRevisionId());
for (Map.Entry<String, String> entry : node.getProperties().entrySet()) {
copy.addProperty(entry.getKey(), entry.getValue());
}
for (Iterator<Node> it = node.getChildNodeEntries(0, -1); it.hasNext(); ) {
Node child = it.next();
copy.addChildNodeEntry(copy(child));
}