/**
  * Load product. return item otherwise create item.
  *
  * @param int $productId
  *
  * @return bool
  */
 public function loadProduct($productId)
 {
     $collection = $this->catalogCollection->create()->addFieldToFilter('product_id', $productId)->setPageSize(1);
     //@codingStandardsIgnoreStart
     if ($collection->getSize()) {
         return $collection->getFirstItem();
         //@codingStandardsIgnoreEnd
     } else {
         $this->catalogFactory->create()->setProductId($productId)->save();
     }
     return false;
 }
 /**
  * Get product collection to export.
  *
  * @param      $store
  * @param bool $modified
  *
  * @return bool
  */
 public function _getProductsToExport($store, $modified = false)
 {
     $limit = $this->helper->getWebsiteConfig(\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_TRANSACTIONAL_DATA_SYNC_LIMIT);
     $connectorCollection = $this->catalogCollectionFactory->create();
     //for modified catalog
     if ($modified) {
         $connectorCollection->addFieldToFilter('modified', ['eq' => '1']);
     } else {
         $connectorCollection->addFieldToFilter('imported', ['null' => 'true']);
     }
     //set limit for collection
     $connectorCollection->setPageSize($limit);
     //check number of products
     if ($connectorCollection->getSize()) {
         $productIds = $connectorCollection->getColumnValues('product_id');
         $productCollection = $this->productCollection->create()->addAttributeToSelect('*')->addStoreFilter($store)->addAttributeToFilter('entity_id', ['in' => $productIds]);
         //visibility filter
         if ($visibility = $this->helper->getWebsiteConfig(\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_SYNC_CATALOG_VISIBILITY)) {
             $visibility = explode(',', $visibility);
             $productCollection->addAttributeToFilter('visibility', ['in' => $visibility]);
         }
         //type filter
         if ($type = $this->helper->getWebsiteConfig(\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_SYNC_CATALOG_TYPE)) {
             $type = explode(',', $type);
             $productCollection->addAttributeToFilter('type_id', ['in' => $type]);
         }
         $productCollection->addWebsiteNamesToResult()->addCategoryIds()->addOptionsToResult();
         return $productCollection;
     }
     return false;
 }