final Map<String, NodeRef> entries) {
List<NodeRef> refsByDepth = Lists.newArrayList(entries.values());
Collections.sort(refsByDepth, DEEPEST_LAST_COMPARATOR);
Node rootNode = Node.create(ROOT, rootId, ObjectId.NULL, TYPE.TREE, null);
MutableTree root = new MutableTree(rootNode);
Envelope bounds = new Envelope();
for (NodeRef entry : refsByDepth) {
Node node = entry.getNode();
node.expand(bounds);
String parentPath = entry.getParentPath();
root.setChild(parentPath, node);
}
// recreate root node with the appropriate bounds
rootNode = Node.create(ROOT, rootId, ObjectId.NULL, TYPE.TREE, bounds);