diff --git a/core/modules/aggregator/aggregator.module b/core/modules/aggregator/aggregator.module
index bf17629..e0cb6a3 100644
--- a/core/modules/aggregator/aggregator.module
+++ b/core/modules/aggregator/aggregator.module
@@ -147,12 +147,10 @@ function aggregator_permission() {
  * Queues news feeds for updates once their refresh interval has elapsed.
  */
 function aggregator_cron() {
-  $result = db_query('SELECT fid FROM {aggregator_feed} WHERE queued = 0 AND checked + refresh < :time AND refresh <> :never', array(
-    ':time' => REQUEST_TIME,
-    ':never' => AGGREGATOR_CLEAR_NEVER
-  ));
   $queue = \Drupal::queue('aggregator_feeds');
-  foreach ($result->fetchCol() as $fid) {
+
+  $result = \Drupal::entityManager()->getStorageController('aggregator_feed')->getFeedIdsToRefresh();
+  foreach ($result as $fid) {
     $feed = aggregator_feed_load($fid);
     if ($queue->createItem($feed)) {
       // Add timestamp to avoid queueing item more than once.
@@ -162,10 +160,17 @@ function aggregator_cron() {
   }
 
   // Remove queued timestamp after 6 hours assuming the update has failed.
-  db_update('aggregator_feed')
-    ->fields(array('queued' => 0))
+  $result = \Drupal::entityQuery('aggregator_feed')
     ->condition('queued', REQUEST_TIME - (3600 * 6), '<')
     ->execute();
+
+  if ($result) {
+    $feeds = entity_load_multiple('aggregator_feed', $result);
+    foreach ($feeds as $feed) {
+      $feed->queued->value = 0;
+      $feed->save();
+    }
+  }
 }
 
 /**
@@ -293,8 +298,9 @@ function aggregator_feed_load($fid) {
  */
 function template_preprocess_aggregator_block_item(&$variables) {
   // Display the external link to the item.
-  $variables['url'] = check_url($variables['item']->link);
-  $variables['title'] = check_plain($variables['item']->title);
+  $item = $variables['item'];
+  $variables['url'] = check_url($item->getLink());
+  $variables['title'] = check_plain($item->getTitle());
 }
 
 /**
diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Controller/AggregatorController.php b/core/modules/aggregator/lib/Drupal/aggregator/Controller/AggregatorController.php
index d75a28a..6bc4c1a 100644
--- a/core/modules/aggregator/lib/Drupal/aggregator/Controller/AggregatorController.php
+++ b/core/modules/aggregator/lib/Drupal/aggregator/Controller/AggregatorController.php
@@ -17,6 +17,7 @@
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\HttpFoundation\Response;
 use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
+use Drupal\aggregator\FeedStorageControllerInterface;
 
 /**
  * Returns responses for aggregator module routes.
@@ -31,13 +32,21 @@ class AggregatorController extends ControllerBase implements ContainerInjectionI
   protected $database;
 
   /**
+   * The feed storage controller.
+   *
+   * @var \Drupal\aggregator\FeedStorageControllerInterface
+   */
+   protected $feedStorage;
+
+  /**
    * Constructs a \Drupal\aggregator\Controller\AggregatorController object.
    *
    * @param \Drupal\Core\Database\Connection $database
    *   The database connection.
    */
-  public function __construct(Connection $database) {
+  public function __construct(Connection $database, FeedStorageControllerInterface $feed_storage) {
     $this->database = $database;
+    $this->feedStorage = $feed_storage;
   }
 
   /**
@@ -45,7 +54,8 @@ public function __construct(Connection $database) {
    */
   public static function create(ContainerInterface $container) {
     return new static(
-      $container->get('database')
+      $container->get('database'),
+      $container->get('entity.manager')->getStorageController('aggregator_feed')
     );
   }
 
@@ -78,7 +88,7 @@ public function viewFeed(FeedInterface $aggregator_feed) {
     $feed_source = $entity_manager->getViewBuilder('aggregator_feed')
       ->view($aggregator_feed, 'default');
     // Load aggregator feed item for the particular feed id.
-    $items = $entity_manager->getStorageController('aggregator_item')->loadByFeed($aggregator_feed->id());
+    $items = $entity_manager->getStorageController('aggregator_item')->loadByFeed($aggregator_feed->id(), 20);
     // Print the feed items.
     $build = $this->buildPageList($items, $feed_source);
     return $build;
@@ -135,36 +145,36 @@ public function feedRefresh(FeedInterface $aggregator_feed) {
    *   A render array as expected by drupal_render().
    */
   public function adminOverview() {
-    $result = $this->database->query('SELECT f.fid, f.title, f.url, f.refresh, f.checked, f.link, f.description, f.hash, f.etag, f.modified, f.image, COUNT(i.iid) AS items FROM {aggregator_feed} f LEFT JOIN {aggregator_item} i ON f.fid = i.fid GROUP BY f.fid, f.title, f.url, f.refresh, f.checked, f.link, f.description, f.hash, f.etag, f.modified, f.image ORDER BY f.title');
+    $feeds = $this->feedStorage->loadMultiple();
 
     $header = array($this->t('Title'), $this->t('Items'), $this->t('Last update'), $this->t('Next update'), $this->t('Operations'));
     $rows = array();
-    foreach ($result as $feed) {
+    foreach ($feeds as $feed) {
       $row = array();
-      $row[] = l($feed->title, "aggregator/sources/$feed->fid");
-      $row[] = format_plural($feed->items, '1 item', '@count items');
-      $row[] = ($feed->checked ? $this->t('@time ago', array('@time' => format_interval(REQUEST_TIME - $feed->checked))) : $this->t('never'));
-      $row[] = ($feed->checked && $feed->refresh ? $this->t('%time left', array('%time' => format_interval($feed->checked + $feed->refresh - REQUEST_TIME))) : $this->t('never'));
+      $row[] = l($feed->title->value, "aggregator/sources/" . $feed->fid->value);
+      $row[] = format_plural($this->feedStorage->getItemCount($feed), '1 item', '@count items');
+      $row[] = ($feed->checked->value ? $this->t('@time ago', array('@time' => format_interval(REQUEST_TIME - $feed->checked->value))) : $this->t('never'));
+      $row[] = ($feed->checked->value && $feed->refresh->value ? $this->t('%time left', array('%time' => format_interval($feed->checked->value + $feed->refresh->value - REQUEST_TIME))) : $this->t('never'));
       $links = array();
       $links['edit'] = array(
         'title' => $this->t('Edit'),
         'route_name' => 'aggregator.feed_edit',
-        'route_parameters' => array('aggregator_feed' => $feed->fid),
+        'route_parameters' => array('aggregator_feed' => $feed->id()),
       );
       $links['delete'] = array(
         'title' => $this->t('Delete'),
         'route_name' => 'aggregator.feed_delete',
-        'route_parameters' => array('aggregator_feed' => $feed->fid),
+        'route_parameters' => array('aggregator_feed' => $feed->id()),
       );
       $links['remove'] = array(
         'title' => $this->t('Remove items'),
         'route_name' => 'aggregator.feed_items_delete',
-        'route_parameters' => array('aggregator_feed' => $feed->fid),
+        'route_parameters' => array('aggregator_feed' => $feed->id()),
       );
       $links['update'] = array(
         'title' => $this->t('Update items'),
         'route_name' => 'aggregator.feed_refresh',
-        'route_parameters' => array('aggregator_feed' => $feed->fid),
+        'route_parameters' => array('aggregator_feed' => $feed->id()),
       );
       $row[] = array(
         'data' => array(
@@ -222,7 +232,7 @@ public function sources() {
         ->get('source.list_max');
       if ($aggregator_summary_items) {
         $items = $entity_manager->getStorageController('aggregator_item')
-          ->loadByFeed($feed->id());
+          ->loadByFeed($feed->id(), 20);
         if ($items) {
           $summary_items = $entity_manager->getViewBuilder('aggregator_item')
             ->viewMultiple($items, 'summary');
diff --git a/core/modules/aggregator/lib/Drupal/aggregator/FeedStorageController.php b/core/modules/aggregator/lib/Drupal/aggregator/FeedStorageController.php
index 4758633..234b190 100644
--- a/core/modules/aggregator/lib/Drupal/aggregator/FeedStorageController.php
+++ b/core/modules/aggregator/lib/Drupal/aggregator/FeedStorageController.php
@@ -32,4 +32,20 @@ public function getFeedDuplicates(FeedInterface $feed) {
     return $query->fetchAll();
   }
 
+  /**
+   * {@inheritdoc}
+   */
+  public function getItemCount(FeedInterface $feed) {
+    return $this->database->query("SELECT COUNT(*) FROM {aggregator_item} WHERE fid = :fid", array(':fid' => $feed->id()))->fetchField();
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getFeedIdsToRefresh() {
+    return $this->database->query('SELECT fid FROM {aggregator_feed} WHERE queued = 0 AND checked  refresh < :time AND refresh <> :never', array(
+      ':time' => REQUEST_TIME,
+      ':never' => AGGREGATOR_CLEAR_NEVER
+    ))->fetchCol();
+  }
 }
diff --git a/core/modules/aggregator/lib/Drupal/aggregator/FeedStorageControllerInterface.php b/core/modules/aggregator/lib/Drupal/aggregator/FeedStorageControllerInterface.php
index aade8b9..746c551 100644
--- a/core/modules/aggregator/lib/Drupal/aggregator/FeedStorageControllerInterface.php
+++ b/core/modules/aggregator/lib/Drupal/aggregator/FeedStorageControllerInterface.php
@@ -26,4 +26,19 @@
    */
   public function getFeedDuplicates(FeedInterface $feed);
 
+  /**
+   * Returns the count of the items in the feed.
+   *
+   * @param Feed $feed
+   *   The feed entity.
+   */
+  public function getItemCount(FeedInterface $feed);
+
+  /**
+   * Returns the fids of feed that need to be refreshed.
+   *
+   *  @return array
+   *    A list of feeds to be refreshed.
+   */
+  public function getFeedIdsToRefresh();
 }
diff --git a/core/modules/aggregator/lib/Drupal/aggregator/ItemStorageController.php b/core/modules/aggregator/lib/Drupal/aggregator/ItemStorageController.php
index a755c21..737d192 100644
--- a/core/modules/aggregator/lib/Drupal/aggregator/ItemStorageController.php
+++ b/core/modules/aggregator/lib/Drupal/aggregator/ItemStorageController.php
@@ -33,7 +33,7 @@ public function loadAll($limit = 20) {
   /**
    * {@inheritdoc}
    */
-  public function loadByFeed($fid, $limit = 20) {
+  public function loadByFeed($fid, $limit = NULL) {
     $query = $this->database->select('aggregator_item', 'i');
     $query
       ->fields('i', array('iid'))
@@ -53,13 +53,15 @@ public function loadByFeed($fid, $limit = 20) {
    *   An array of the feed items.
    */
   protected function executeFeedItemQuery(SelectInterface $query, $limit) {
-    $result = $query
-      ->extend('Drupal\Core\Database\Query\PagerSelectExtender')
-      ->limit($limit)
+    $query->extend('Drupal\Core\Database\Query\PagerSelectExtender')
       ->orderBy('i.timestamp', 'DESC')
-      ->orderBy('i.iid', 'DESC')
-      ->execute();
+      ->orderBy('i.iid', 'DESC');
 
+    if ($limit) {
+      $query->limit($limit);
+    }
+
+    $result = $query->execute();
     return $this->loadMultiple($result->fetchCol());
   }
 
diff --git a/core/modules/aggregator/lib/Drupal/aggregator/ItemStorageControllerInterface.php b/core/modules/aggregator/lib/Drupal/aggregator/ItemStorageControllerInterface.php
index a191352..f55739b 100644
--- a/core/modules/aggregator/lib/Drupal/aggregator/ItemStorageControllerInterface.php
+++ b/core/modules/aggregator/lib/Drupal/aggregator/ItemStorageControllerInterface.php
@@ -32,11 +32,11 @@ public function loadAll($limit = 20);
    * @param int $fid
    *   The feed ID to filter by.
    * @param int $limit
-   *   (optional) The number of items to return. Defaults to 20.
+   *   (optional) The number of items to return. Defaults to unlimited.
    *
    * @return \Drupal\aggregator\ItemInterface[]
    *   An array of the feed items.
    */
-  public function loadByFeed($fid, $limit = 20);
+  public function loadByFeed($fid, $limit = NULL);
 
 }
diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/Block/AggregatorFeedBlock.php b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/Block/AggregatorFeedBlock.php
index 767639e..b30d228 100644
--- a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/Block/AggregatorFeedBlock.php
+++ b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/Block/AggregatorFeedBlock.php
@@ -13,6 +13,9 @@
 use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
 use Drupal\Core\Session\AccountInterface;
 use Symfony\Component\DependencyInjection\ContainerInterface;
+use Drupal\aggregator\FeedStorageControllerInterface;
+use Drupal\aggregator\ItemStorageControllerInterface;
+use Drupal\Core\Entity\Query\QueryFactory;
 
 /**
  * Provides an 'Aggregator feed' block with the latest items from the feed.
@@ -28,9 +31,16 @@ class AggregatorFeedBlock extends BlockBase implements ContainerFactoryPluginInt
   /**
    * The entity storage controller for feeds.
    *
-   * @var \Drupal\Core\Entity\EntityStorageControllerInterface
+   * @var \Drupal\aggregator\FeedStorageControllerInterface
    */
-  protected $storageController;
+  protected $feedStorage;
+
+  /**
+   * The entity storage controller for items.
+   *
+   * @var \Drupal\aggregator\ItemStorageControllerInterface
+   */
+  protected $itemStorage;
 
   /**
    * The database connection.
@@ -40,6 +50,13 @@ class AggregatorFeedBlock extends BlockBase implements ContainerFactoryPluginInt
   protected $connection;
 
   /**
+   * The entity query factory service.
+   *
+   * @var \Drupal\Core\Entity\Query\QueryFactory
+   */
+  protected $entityQuery;
+
+  /**
    * Constructs an AggregatorFeedBlock object.
    *
    * @param array $configuration
@@ -53,10 +70,12 @@ class AggregatorFeedBlock extends BlockBase implements ContainerFactoryPluginInt
    * @param \Drupal\Core\Database\Connection $connection
    *   The database connection.
    */
-  public function __construct(array $configuration, $plugin_id, array $plugin_definition, EntityStorageControllerInterface $storage_controller, Connection $connection) {
+  public function __construct(array $configuration, $plugin_id, array $plugin_definition, FeedStorageControllerInterface $feed_storage, ItemStorageControllerInterface $item_storage, Connection $connection, QueryFactory $entity_query) {
     parent::__construct($configuration, $plugin_id, $plugin_definition);
-    $this->storageController = $storage_controller;
+    $this->feedStorage = $feed_storage;
+    $this->itemStorage = $item_storage;
     $this->connection = $connection;
+    $this->entityQuery = $entity_query;
   }
 
 
@@ -69,7 +88,9 @@ public static function create(ContainerInterface $container, array $configuratio
       $plugin_id,
       $plugin_definition,
       $container->get('entity.manager')->getStorageController('aggregator_feed'),
-      $container->get('database')
+      $container->get('entity.manager')->getStorageController('aggregator_item'),
+      $container->get('database'),
+      $container->get('entity.query')
     );
   }
 
@@ -97,7 +118,7 @@ public function access(AccountInterface $account) {
    * Overrides \Drupal\block\BlockBase::blockForm().
    */
   public function blockForm($form, &$form_state) {
-    $feeds = $this->storageController->loadMultiple();
+    $feeds = $this->feedStorage->loadMultiple();
     $options = array();
     foreach ($feeds as $feed) {
       $options[$feed->id()] = $feed->label();
@@ -130,27 +151,35 @@ public function blockSubmit($form, &$form_state) {
    */
   public function build() {
     // Load the selected feed.
-    if ($feed = $this->storageController->load($this->configuration['feed'])) {
-      $result = $this->connection->queryRange("SELECT * FROM {aggregator_item} WHERE fid = :fid ORDER BY timestamp DESC, iid DESC", 0, $this->configuration['block_count'], array(':fid' => $feed->id()));
+    if ($feed = $this->feedStorage->load($this->configuration['feed'])) {
+      $result = $this->entityQuery->get('aggregator_item')
+        ->condition('fid', $feed->id())
+        ->range(0, $this->configuration['block_count'])
+        ->sort('timestamp', 'DESC')
+        ->sort('iid', 'DESC')
+        ->execute();
+
+      $items = $this->itemStorage->loadMultiple($result);
+
       $more_link = array(
         '#theme' => 'more_link',
         '#url' => 'aggregator/sources/' . $feed->id(),
         '#title' => t("View this feed's recent news."),
       );
       $read_more = drupal_render($more_link);
-      $items = array();
-      foreach ($result as $item) {
+      $rendered_items = array();
+      foreach ($items as $item) {
         $aggregator_block_item = array(
           '#theme' => 'aggregator_block_item',
           '#item' => $item,
         );
-        $items[] = drupal_render($aggregator_block_item);
+        $rendered_items[] = drupal_render($aggregator_block_item);
       }
       // Only display the block if there are items to show.
-      if (count($items) > 0) {
+      if (count($rendered_items) > 0) {
         $item_list = array(
           '#theme' => 'item_list',
-          '#items' => $items,
+          '#items' => $rendered_items,
         );
         return array(
           '#children' => drupal_render($item_list) . $read_more,
diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/aggregator/processor/DefaultProcessor.php b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/aggregator/processor/DefaultProcessor.php
index 94a3da5..21b8569 100644
--- a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/aggregator/processor/DefaultProcessor.php
+++ b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/aggregator/processor/DefaultProcessor.php
@@ -7,11 +7,13 @@
 
 namespace Drupal\aggregator\Plugin\aggregator\processor;
 
+use Drupal\aggregator\ItemStorageControllerInterface;
 use Drupal\aggregator\Plugin\AggregatorPluginSettingsBase;
 use Drupal\aggregator\Plugin\ProcessorInterface;
 use Drupal\aggregator\Entity\Feed;
 use Drupal\Core\Database\Database;
 use Drupal\Core\Config\ConfigFactory;
+use Drupal\Core\Entity\Query\QueryFactory;
 use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 
@@ -35,6 +37,20 @@ class DefaultProcessor extends AggregatorPluginSettingsBase implements Processor
    */
   protected $configFactory;
 
+   /**
+   * The entity query factory service.
+   *
+   * @var \Drupal\Core\Entity\Query\QueryFactory
+   */
+  protected $entityQuery;
+
+  /**
+   * The entity storage controller for items.
+   *
+   * @var \Drupal\aggregator\ItemStorageControllerInterface
+   */
+  protected $itemStorage;
+
   /**
    * Constructs a DefaultProcessor object.
    *
@@ -47,8 +63,11 @@ class DefaultProcessor extends AggregatorPluginSettingsBase implements Processor
    * @param \Drupal\Core\Config\ConfigFactory $config
    *   The configuration factory object.
    */
-  public function __construct(array $configuration, $plugin_id, array $plugin_definition, ConfigFactory $config) {
+  public function __construct(array $configuration, $plugin_id, array $plugin_definition, ConfigFactory $config, QueryFactory $entity_query, ItemStorageControllerInterface $item_storage) {
     $this->configFactory = $config;
+    $this->entityQuery = $entity_query;
+    $this->itemStorage = $item_storage;
+
     // @todo Refactor aggregator plugins to ConfigEntity so merging
     //   the configuration here is not needed.
     parent::__construct($configuration + $this->getConfiguration(), $plugin_id, $plugin_definition);
@@ -62,7 +81,9 @@ public static function create(ContainerInterface $container, array $configuratio
       $configuration,
       $plugin_id,
       $plugin_definition,
-      $container->get('config.factory')
+      $container->get('config.factory'),
+      $container->get('entity.query'),
+      $container->get('entity.manager')->getStorageController('aggregator_item')
     );
   }
 
@@ -179,9 +200,8 @@ public function process(Feed $feed) {
    * {@inheritdoc}
    */
   public function remove(Feed $feed) {
-    $iids = Database::getConnection()->query('SELECT iid FROM {aggregator_item} WHERE fid = :fid', array(':fid' => $feed->id()))->fetchCol();
-    if ($iids) {
-      entity_delete_multiple('aggregator_item', $iids);
+    if ($items = $this->itemStorage->loadByFeed($feed->id())) {
+      $this->itemStorage->delete($items);
     }
     // @todo This should be moved out to caller with a different message maybe.
     drupal_set_message(t('The news items from %site have been removed.', array('%site' => $feed->label())));
@@ -198,13 +218,13 @@ public function postProcess(Feed $feed) {
     if ($aggregator_clear != AGGREGATOR_CLEAR_NEVER) {
       // Remove all items that are older than flush item timer.
       $age = REQUEST_TIME - $aggregator_clear;
-      $iids = Database::getConnection()->query('SELECT iid FROM {aggregator_item} WHERE fid = :fid AND timestamp < :timestamp', array(
-        ':fid' => $feed->id(),
-        ':timestamp' => $age,
-      ))
-      ->fetchCol();
-      if ($iids) {
-        entity_delete_multiple('aggregator_item', $iids);
+      $result = $this->entityQuery->get('aggregator_item')
+        ->condition('fid', $feed->id())
+        ->condition('timestamp', $age, '<')
+        ->execute();
+      if ($result) {
+        $entities = $this->itemStorage->loadMultiple($result);
+        $this->itemStorage->delete($entities);
       }
     }
   }
