/**
  * Get the categories
  * 
  * @param SimpleXMLElement $node XML node
  * 
  * @return array
  */
 protected function getCategories($node)
 {
     $categories = array();
     foreach ($node->tree as $tree) {
         $path = array();
         foreach ($tree->entry as $entry) {
             $attributes = $entry->attributes();
             $id = (int) $attributes['id'];
             $depth = (int) $attributes['depth'];
             $name = (string) $entry;
             $category = new Nicovogelaar_Nedisimport_Model_Entity_Category();
             $category->setId($id);
             $category->setDepth($depth);
             $category->setName($name);
             $path[] = $category;
         }
         $categories[] = $path;
     }
     return $categories;
 }
 /**
  * Create category
  * 
  * @param Nicovogelaar_Nedisimport_Model_Entity_Category $category Category
  * @param array                                          $path     Path
  * 
  * @return Mage_Catalog_Model_Category
  */
 protected function createCategory(Nicovogelaar_Nedisimport_Model_Entity_Category $category, array $path)
 {
     $name = $category->getName();
     $urlKey = $this->formatUrlKey($name);
     $category = Mage::getModel('catalog/category')->setStoreId(Mage_Core_Model_App::ADMIN_STORE_ID)->setName($name)->setUrlKey($urlKey)->setIsActive(1)->setDisplayMode('PRODUCTS')->setIsAnchor(1)->setPath(implode('/', $path))->save();
     return $category;
 }