code: private function findExistingCategory(Category $category, $parentCategory)
      {
          $existingCategory = $this->categoryRepository->findOneBy([
              'name' => $category->getName(),
              'parentId' => $parentCategory,
          ]);
  
          if (null === $existingCategory) {
              return null;
          }
  
          return $existingCategory->getId();
      }
docs: @param Category $category
  @param int      $parentCategory
  
  @return null|int