/**
  * @param int $prodId Magento ID for the product
  * @param array $categories Odoo IDs of the categories.
  */
 public function replicateCategories($prodId, $categories)
 {
     /* get current categories links for the product */
     $prod = $this->_mageRepoProd->getById($prodId);
     $sku = $prod->getSku();
     $catsExist = $prod->getCategoryIds();
     $catsFound = [];
     if (is_array($categories)) {
         foreach ($categories as $catOdooId) {
             $catMageId = $this->_repoRegistry->getCategoryMageIdByOdooId($catOdooId);
             if (!in_array($catMageId, $catsExist)) {
                 /* create new product link if not exists */
                 /** @var CategoryProductLinkInterface $prodLink */
                 $prodLink = $this->_manObj->create(CategoryProductLinkInterface::class);
                 $prodLink->setCategoryId($catMageId);
                 $prodLink->setSku($sku);
                 $prodLink->setPosition(1);
                 $this->_mageRepoCatLink->save($prodLink);
             }
             /* register found link */
             $catsFound[] = $catMageId;
         }
     }
     /* get difference between exist & found */
     $diff = array_diff($catsExist, $catsFound);
     foreach ($diff as $catMageId) {
         $this->_mageRepoCatLink->deleteByIds($catMageId, $sku);
     }
 }