/**
  * Set data from $actions to the given $product
  *
  * Actions should looks like that
  *
  * $actions =
  * [
  *     [
  *          'field'   => 'group',
  *          'value'   => 'summer_clothes',
  *          'options' => null
  *      ],
  *      [
  *          'field'   => 'category',
  *          'value'   => 'catalog_2013,catalog_2014',
  *          'options' => null
  *      ],
  * ]
  *
  * @param ProductInterface $product
  * @param array            $actions
  *
  * @throws \LogicException
  *
  * @return ProductInterface $product
  */
 protected function updateProduct(ProductInterface $product, array $actions)
 {
     $modifiedAttributesNb = 0;
     foreach ($actions as $action) {
         $attribute = $this->attributeRepository->findOneBy(['code' => $action['field']]);
         if (null === $attribute) {
             throw new \LogicException(sprintf('Attribute with code %s does not exist'), $action['field']);
         }
         if ($product->isAttributeEditable($attribute)) {
             $this->propertySetter->setData($product, $action['field'], $action['value'], $action['options']);
             $modifiedAttributesNb++;
         }
     }
     if (0 === $modifiedAttributesNb) {
         $this->stepExecution->incrementSummaryInfo('skipped_products');
         $this->stepExecution->addWarning($this->getName(), 'pim_enrich.mass_edit_action.edit-common-attributes.message.no_valid_attribute', [], $product);
         return null;
     }
     return $product;
 }