private function getCategoryIdentities()
    {
        $identities  = [];
        $categoryIds = [];
        $origData    = $this->optimizer->getOrigData();
        $data        = $this->optimizer->getData();

        // If optimizer was previously assigned to all categories, or is now set to all categories.
        $isAppliedToAllCategories = empty($data['catalog_view_container'])
            || (bool) $data['catalog_view_container']['apply_to'] === false;

        $wasAppliedToAllCategories = empty($origData['catalog_view_container']['category_ids']);

        if ($isAppliedToAllCategories || $wasAppliedToAllCategories) {
            $identities[] = \Magento\Catalog\Model\Category::CACHE_TAG;
        }

        if (!empty($data['catalog_view_container']['category_ids'])) {
            $categoryIds = array_merge($categoryIds, $data['catalog_view_container']['category_ids']);
        }

        if (!empty($origData['catalog_view_container']['category_ids'])) {
            $categoryIds = array_merge($categoryIds, $origData['catalog_view_container']['category_ids']);
        }

        $categoryIds = array_filter(array_unique($categoryIds));
        if (!empty($categoryIds)) {
            $categoryTags = array_map(function ($categoryId) {
                return \Magento\Catalog\Model\Category::CACHE_TAG . '_' . $categoryId;
            }, $categoryIds);

            $identities = array_merge($identities, $categoryTags);
        }

        return $identities;
    }