/**
  * Get addressbook by import type.
  *
  * @param $importType
  * @param $websiteId
  *
  * @return mixed|string
  */
 public function _getAddressBook($importType, $websiteId)
 {
     switch ($importType) {
         case \Dotdigitalgroup\Email\Model\Importer::IMPORT_TYPE_CONTACT:
             $addressBook = $this->helper->getCustomerAddressBook($websiteId);
             break;
         case \Dotdigitalgroup\Email\Model\Importer::IMPORT_TYPE_SUBSCRIBERS:
             $addressBook = $this->helper->getSubscriberAddressBook($websiteId);
             break;
         case \Dotdigitalgroup\Email\Model\Importer::IMPORT_TYPE_GUEST:
             $addressBook = $this->helper->getGuestAddressBook($websiteId);
             break;
         default:
             $addressBook = '';
     }
     return $addressBook;
 }
 /**
  * GUEST SYNC.
  */
 public function sync()
 {
     $this->start = microtime(true);
     $websites = $this->helper->getWebsites();
     $started = false;
     foreach ($websites as $website) {
         //check if the guest is mapped and enabled
         $addresbook = $this->helper->getGuestAddressBook($website);
         $guestSyncEnabled = $this->helper->isGuestSyncEnabled($website);
         $apiEnabled = $this->helper->isEnabled($website);
         if ($addresbook && $guestSyncEnabled && $apiEnabled) {
             //sync guests for website
             $this->exportGuestPerWebsite($website);
             if ($this->countGuests && !$started) {
                 $this->helper->log('----------- Start guest sync ----------');
                 $started = true;
             }
         }
     }
     if ($this->countGuests) {
         $this->helper->log('---- End Guest total time for guest sync : ' . gmdate('H:i:s', microtime(true) - $this->start));
     }
 }