/**
  * Move to another parent node
  *
  * @param CategoryItemEntity $item   item object
  * @param CategoryItemEntity $parent new parent item object
  * @return void
  * @throws UnableMoveToSelfException
  */
 public function moveTo(CategoryItemEntity $item, CategoryItemEntity $parent = null)
 {
     if ($parent !== null && $item->id === $parent->id) {
         throw new UnableMoveToSelfException();
     }
     $oldParent = $this->parent($item);
     if ($oldParent !== null && $parent !== null && $oldParent->id == $parent->id) {
         return;
     }
     if ($oldParent !== null) {
         $this->itemRepo->unlinkHierarchy($item, $oldParent);
     }
     if ($parent !== null) {
         $this->itemRepo->linkHierarchy($item, $parent);
     }
 }