private function mergeProducts(Product $product, Product $existing)
 {
     $product->setId($existing->getId());
     $product->setV($existing->getV() + 1);
     foreach ($product->getImages() as $image) {
         foreach ($existing->getImages() as $existingImage) {
             if ($image->getUrl() === $existingImage->getUrl()) {
                 $image->setFileId($existingImage->getFileId());
             }
         }
     }
     $categoryIds = $product->getCategoryIds();
     foreach ($product->getCategoryTexts() as $i => $categoryText) {
         foreach ($existing->getCategoryTexts() as $j => $existingCategoryText) {
             if ($categoryText === $existingCategoryText) {
                 $categoryIds[$i] = $existing->getCategoryIds()[$j];
             }
         }
     }
     $product->setCategoryIds($categoryIds);
 }
 /**
  * @param Product $product
  * @return Product
  */
 public function findOneFromEshop(Product $product)
 {
     return $this->findOne([ProductMeta::ESHOP_ID => $product->getEshopId(), ProductMeta::ITEM_GROUP_ID => $product->getItemGroupId(), ProductMeta::ITEM_ID => $product->getItemId()]);
 }