code: function clean(nodes) {
          mark(nodes, []);
          return prune(nodes);
          function mark(nodes, ancestors) {
            _.each(nodes, function(node) {
              if (node.publish) {
                node.good = true;
                _.each(ancestors, function(ancestor) {
                  ancestor.good = true;
                });
              }
              mark(node.children || [], ancestors.concat([ node ]));
            });
          }
          function prune(nodes) {
            var newNodes = [];
            _.each(nodes, function(node) {
              node.children = prune(node.children || []);
              if (node.good) {
                newNodes.push(node);
              }
            });
            return newNodes;
          }
        }
docs: If I can't publish at least one of a node's descendants, prune it from the tree. Returns a pruned version of the tree