/**
  * {@inheritdoc}
  */
 public function process(FeedInterface $feed)
 {
     if (!is_array($feed->items)) {
         return;
     }
     foreach ($feed->items as $item) {
         // @todo: The default entity view builder always returns an empty
         //   array, which is ignored in aggregator_save_item() currently. Should
         //   probably be fixed.
         if (empty($item['title'])) {
             continue;
         }
         // Save this item. Try to avoid duplicate entries as much as possible. If
         // we find a duplicate entry, we resolve it and pass along its ID is such
         // that we can update it if needed.
         if (!empty($item['guid'])) {
             $values = array('fid' => $feed->id(), 'guid' => $item['guid']);
         } elseif ($item['link'] && $item['link'] != $feed->link && $item['link'] != $feed->url) {
             $values = array('fid' => $feed->id(), 'link' => $item['link']);
         } else {
             $values = array('fid' => $feed->id(), 'title' => $item['title']);
         }
         // Try to load an existing entry.
         if ($entry = entity_load_multiple_by_properties('aggregator_item', $values)) {
             $entry = reset($entry);
         } else {
             $entry = entity_create('aggregator_item', array('langcode' => $feed->language()->getId()));
         }
         if ($item['timestamp']) {
             $entry->setPostedTime($item['timestamp']);
         }
         // Make sure the item title and author fit in the 255 varchar column.
         $entry->setTitle(truncate_utf8($item['title'], 255, TRUE, TRUE));
         $entry->setAuthor(truncate_utf8($item['author'], 255, TRUE, TRUE));
         $entry->setFeedId($feed->id());
         $entry->setLink($item['link']);
         $entry->setGuid($item['guid']);
         $description = '';
         if (!empty($item['description'])) {
             $description = $item['description'];
         }
         $entry->setDescription($description);
         $entry->save();
     }
 }