/** * {@inheritdoc} */ public function delete($id) { /** @var $sample \Magento\Downloadable\Model\Sample */ $sample = $this->sampleFactory->create()->load($id); if (!$sample->getId()) { throw new NoSuchEntityException(__('There is no downloadable sample with provided ID.')); } try { $this->resourceModel->delete($sample); } catch (\Exception $exception) { throw new StateException(__('Cannot delete sample with id %1', $sample->getId()), $exception); } return true; }