code: function (node, root) {
      var children = node.children();
      for (var i = 0; i < children.length; i++) {
        var child = children[i];
        this.removeChildren(child, root);
        var removedChild = child.remove();
        if (root._private.data.collapsedChildren == null) {
          root._private.data.collapsedChildren = removedChild;
        }
        else {
          root._private.data.collapsedChildren = root._private.data.collapsedChildren.union(removedChild);
        }
      }
    }
docs: /*
  for all children of the node parameter call this method
  with the same root parameter,
  remove the child and add the removed child to the collapsedchildren data
  of the root to restore them in the case of expandation
  root._private.data.collapsedChildren keeps the nodes to restore when the
  root is expanded