private function saveSearchContainerRelation(\Magento\Framework\Model\AbstractModel $object)
    {
        $searchContainers = $object->getSearchContainer();

        if (is_array($searchContainers) && (count($searchContainers) > 0)) {
            $searchContainerLinks = [];
            $deleteCondition = OptimizerInterface::OPTIMIZER_ID . " = " . $object->getId();

            foreach ($searchContainers as $searchContainer) {
                $searchContainerName = (string) $searchContainer;
                // Treat autocomplete apply_to like the quick search.
                if ($searchContainerName === 'catalog_product_autocomplete') {
                    $searchContainerName = 'quick_search_container';
                }
                $searchContainerData = $object->getData($searchContainerName);
                $applyTo = is_array($searchContainerData) ? ((bool) $searchContainerData['apply_to'] ?? false) : false;
                $searchContainerLinks[(string) $searchContainer] = [
                    OptimizerInterface::OPTIMIZER_ID     => (int) $object->getId(),
                    OptimizerInterface::SEARCH_CONTAINER => (string) $searchContainer,
                    'apply_to'                           => (int) $applyTo,
                ];
            }

            $this->getConnection()->delete($this->getTable(OptimizerInterface::TABLE_NAME_SEARCH_CONTAINER), $deleteCondition);
            $this->getConnection()->insertOnDuplicate(
                $this->getTable(OptimizerInterface::TABLE_NAME_SEARCH_CONTAINER),
                $searchContainerLinks
            );
        }
    }