/**
* 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;
}