public function aroundSave(
        \Magento\Catalog\Model\ResourceModel\Category $categoryResource,
        \Closure $proceed,
        \Magento\Framework\Model\AbstractModel $category
    ) {
        if ($category->getId() && $category->getSortedProducts()) {
            $this->unserializeProductPositions($category);

            if ($category->getIsVirtualCategory()) {
                $category->setPostedProducts([]);
            }

            $categoryResource->addCommitCallback(
                function () use ($category) {
                    $affectedProductIds = $this->getAffectedProductIds($category);
                    $category->setAffectedProductIds($affectedProductIds);
                    $this->saveHandler->saveProductPositions($category);
                }
            );
        }

        return $proceed($category);
    }