/**
  * {@inheritdoc}
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 public function save($sku, SampleInterface $sample, $isGlobalScopeContent = true)
 {
     $product = $this->productRepository->get($sku, true);
     if ($product->getTypeId() !== Type::TYPE_DOWNLOADABLE) {
         throw new InputException(__('Product type of the product must be \'downloadable\'.'));
     }
     //if (!$this->contentValidator->isValid($sample)) {
     //    throw new InputException(__('Provided sample information is invalid.'));
     //}
     if (!in_array($sample->getSampleType(), ['url', 'file'])) {
         throw new InputException(__('Invalid sample type.'));
     }
     $title = $sample->getTitle();
     if (empty($title)) {
         throw new InputException(__('Sample title cannot be empty.'));
     }
     $metadata = $this->metadataPool->getMetadata(ProductInterface::class);
     $sample->setProductId($product->getData($metadata->getLinkField()));
     $this->setFiles($sample);
     return $this->resourceModel->save($sample);
 }