protected function retrieveCategoryFromQueryString()
    {
        $request = $this->getCurrentRequest();
        $categoryId = $request->get('category_id');
        $categorySlug = $request->get('category_slug');

        if (!$categoryId || !$categorySlug) {
            return null;
        }

        return $this->getCategoryManager()->findOneBy([
            'id' => $categoryId,
            'enabled' => true,
        ]);
    }