/**
  * Removes a node from the child nodes array by using
  * reference comparison.
  *
  * @param  Tree_Node $node   The node to remove
  * @param  bool      $search Whether to search child nodes
  * @return bool              True/False
  */
 public function remove(Tree_Node $node, $search = false)
 {
     foreach ($this->nodes as $index => $_node) {
         if ($_node === $node) {
             // Unset parent, tree
             $node->setParent(null);
             $node->setTree(null);
             unset($this->nodes[$index]);
             $this->nodes = array_values($this->nodes);
             return true;
         } else {
             if ($search and $_node->hasChildren()) {
                 $searchNodes[] = $_node;
             }
         }
     }
     // Go thru searching those nodes that have children
     if (!empty($searchNodes)) {
         foreach ($searchNodes as $_node) {
             if ($_node->nodes->remove($node, true)) {
                 return true;
             }
         }
     }
     return false;
 }