/**
  * {@inheritdoc}
  */
 public function convertToProductOption(DataObject $request)
 {
     /** @var DownloadableOption $downloadableOption */
     $downloadableOption = $this->downloadableOptionFactory->create();
     $links = $request->getLinks();
     if (!empty($links) && is_array($links)) {
         $this->dataObjectHelper->populateWithArray($downloadableOption, ['downloadable_links' => $links], 'Magento\\Downloadable\\Api\\Data\\DownloadableOptionInterface');
         return ['downloadable_option' => $downloadableOption];
     }
     return [];
 }
 /**
  * Process cart item product options
  *
  * @param CartItemInterface $cartItem
  * @return CartItemInterface
  */
 public function processOptions(CartItemInterface $cartItem)
 {
     $downloadableLinkIds = [];
     $option = $cartItem->getOptionByCode('downloadable_link_ids');
     if (!empty($option)) {
         $downloadableLinkIds = explode(',', $option->getValue());
     }
     $downloadableOption = $this->downloadableOptionFactory->create();
     $this->dataObjectHelper->populateWithArray($downloadableOption, ['downloadable_links' => $downloadableLinkIds], 'Magento\\Downloadable\\Api\\Data\\DownloadableOptionInterface');
     $productOption = $cartItem->getProductOption() ? $cartItem->getProductOption() : $this->productOptionFactory->create();
     $extensibleAttribute = $productOption->getExtensionAttributes() ? $productOption->getExtensionAttributes() : $this->extensionFactory->create();
     $extensibleAttribute->setDownloadableOption($downloadableOption);
     $productOption->setExtensionAttributes($extensibleAttribute);
     $cartItem->setProductOption($productOption);
     return $cartItem;
 }