public function save()
 {
     foreach ($this->items as $index => $item) {
         //if exists, update
         if ($item["object"]) {
             $item["object"]->update($item);
             //$item is of type array['category1'=>...,]
         } else {
             //create new producttype plus parents
             $heirarchy = ProducttypeTable::cascadeCreate($item["name"]);
             //update details for last node
             $item["object"] = $heirarchy[count($producttypes) - 1];
             $item["object"]->update(array('description' => $item["description"], 'category1' => $item["category1"], 'category2' => $item["category2"], 'category3' => $item["category3"], 'category4' => $item["category4"], 'category5' => $item["category5"], 'category6' => $item["category6"], 'category7' => $item["category7"], 'category8' => $item["category8"], 'category9' => $item["category9"], 'category10' => $item["category10"]));
         }
     }
 }