protected function _nodeToArray(Varien_Data_Tree_Node $node)
 {
     if (empty($node)) {
         return array();
     }
     $result = $node->debug();
     $result['category_id'] = $node->getId();
     $result['parent_id'] = $node->getParentId();
     $result['name'] = $node->getName();
     $result['is_active'] = $node->getIsActive();
     $result['is_anchor'] = $node->getIsAnchor();
     $result['url_key'] = $node->getUrlKey();
     $result['url'] = $node->getRequestPath();
     $result['position'] = $node->getPosition();
     $result['level'] = $node->getLevel();
     $result['products'] = $node->getProducts();
     $result['children'] = array();
     foreach ($node->getChildren() as $child) {
         $result['children'][] = $this->_nodeToArray($child);
     }
     return $result;
 }