/**
  * Remove single item or all descendant
  *
  * @param CategoryItemEntity $item  item object
  * @param bool               $batch if true then remove all descendant
  * @return void
  */
 public function removeItem(CategoryItemEntity $item, $batch = true)
 {
     $parent = $children = null;
     if ($batch === true) {
         $items = $this->itemRepo->fetchDesc($item, 0, false);
     } else {
         $items = [$item];
         $parent = $this->parent($item);
         $children = $this->children($item);
     }
     $category = $this->get($item->categoryId);
     foreach ($items as $item) {
         $this->decrement($category);
         $this->itemRepo->delete($item);
         $this->itemRepo->removeHierarchy($item);
     }
     if ($parent && $children) {
         foreach ($children as $child) {
             $this->itemRepo->insertHierarchy($child, $parent);
         }
     }
 }