Author: Aurelien FOUCRET (aurelien.foucret@smile.fr)
Inheritance: extends Magento\Framework\Model\ResourceModel\Db\AbstractDb
 /**
  * List of product that have been moved during the save.
  *
  * @param \Magento\Catalog\Model\Category $category Category
  *
  * @return array
  */
 private function getAffectedProductIds($category)
 {
     $oldPositionProductIds = array_keys($this->saveHandler->getProductPositionsByCategory($category));
     $newPositionProductIds = array_keys($category->getSortedProducts());
     $affectedProductIds = array_merge($oldPositionProductIds, $newPositionProductIds);
     if ($category->getAffectedProductIds()) {
         $affectedProductIds = array_merge($affectedProductIds, $category->getAffectedProductIds());
     }
     return $affectedProductIds;
 }
 /**
  * Load product saved positions for the current category.
  *
  * @param Category $category Category.
  *
  * @return array
  */
 private function getProductSavedPositions(Category $category)
 {
     $productPositions = [];
     if ($category->getId()) {
         $productPositions = $this->productPositionResource->getProductPositionsByCategory($category);
     }
     return json_encode($productPositions, JSON_FORCE_OBJECT);
 }