/**
  * Fetch local records for all the found dedup records
  *
  * @param EventInterface $event Event
  *
  * @return void
  */
 protected function fetchLocalRecords($event)
 {
     parent::fetchLocalRecords($event);
     if (!isset($_ENV['VUFIND_API_CALL']) || !$_ENV['VUFIND_API_CALL']) {
         return;
     }
     $config = $this->serviceLocator->get('VuFind\\Config');
     $searchConfig = $config->get($this->searchConfig);
     if (!isset($searchConfig->Records->apiExcludedSources)) {
         return;
     }
     $excluded = explode(',', $searchConfig->Records->apiExcludedSources);
     $result = $event->getTarget();
     foreach ($result->getRecords() as $record) {
         $fields = $record->getRawData();
         if (!isset($fields['dedup_data'])) {
             continue;
         }
         foreach ($excluded as $item) {
             unset($fields['dedup_data'][$item]);
         }
         $record->setRawData($fields);
     }
 }