Adapter/ShopwareAdapter/ServiceBus/CommandHandler/Category/HandleCategoryCommandHandler.php
private function validIdentity(Identity $categoryIdentity, CategoryModel $shopMainCategory)
    {
        try {
            $existingCategory = $this->categoryRepository->find($categoryIdentity->getAdapterIdentifier());

            if (null === $existingCategory) {
                return false;
            }

            $extractedCategoryPath = array_filter(explode('|', $existingCategory->getPath()));

            if (in_array($shopMainCategory->getId(), $extractedCategoryPath)) {
                return true;
            }

            return false;
        } catch (Exception $exception) {
            return false;
        }
    }
private function validIdentity(Identity $categoryIdentity, CategoryModel $shopMainCategory)
    {
        try {
            $existingCategory = $this->categoryRepository->find($categoryIdentity->getAdapterIdentifier());

            if (null === $existingCategory) {
                return false;
            }

            $extractedCategoryPath = array_filter(explode('|', $existingCategory->getPath()));

            if (in_array($shopMainCategory->getId(), $extractedCategoryPath)) {
                return true;
            }

            return false;
        } catch (Exception $exception) {
            return false;
        }
    }
@param Identity      $categoryIdentity
@param CategoryModel $shopMainCategory

@return bool