diff --git a/core/modules/forum/forum.module b/core/modules/forum/forum.module
index 0f076c4..6ac4c8a 100644
--- a/core/modules/forum/forum.module
+++ b/core/modules/forum/forum.module
@@ -279,10 +279,12 @@ function forum_node_validate(EntityInterface $node, $form) {
           form_set_error('taxonomy_forums', t('Select a forum.'));
           continue;
         }
-        $used = db_query_range('SELECT 1 FROM {taxonomy_term_data} WHERE tid = :tid AND vid = :vid', 0, 1, array(
-          ':tid' => $term->id(),
-          ':vid' => $term->bundle(),
-        ))->fetchField();
+        $used = \Drupal::entityQuery('taxonomy_term')
+          ->condition('tid', $term->id())
+          ->condition('vid', $term->bundle())
+          ->range(0, 1)
+          ->count()
+          ->execute();
         if ($used && !empty($term->forum_container->value)) {
           form_set_error('taxonomy_forums', t('The item %forum is a forum container, not a forum. Select one of the forums below instead.', array('%forum' => $term->label())));
         }
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Form/VocabularyResetForm.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Form/VocabularyResetForm.php
index 4f0740f..985f58e 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Form/VocabularyResetForm.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Form/VocabularyResetForm.php
@@ -7,7 +7,7 @@
 
 namespace Drupal\taxonomy\Form;
 
-use Drupal\Core\Database\Connection;
+use Drupal\taxonomy\TermStorageControllerInterface;
 use Drupal\Core\Entity\EntityConfirmFormBase;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 
@@ -17,17 +17,20 @@
 class VocabularyResetForm extends EntityConfirmFormBase {
 
   /**
-   * The database connection object.
+   * The term storage.
    *
-   * @var \Drupal\Core\Database\Connection
+   * @var \Drupal\taxonomy\TermStorageControllerInterface
    */
-  protected $connection;
+  protected $termStorage;
 
   /**
    * Constructs a new VocabularyResetForm object.
+   *
+   * @param \Drupal\taxonomy\TermStorageControllerInterface $term_storage
+   *   The term storage.
    */
-  public function __construct(Connection $connection) {
-    $this->connection = $connection;
+  public function __construct(TermStorageControllerInterface $term_storage) {
+    $this->termStorage = $term_storage;
   }
 
   /**
@@ -35,7 +38,7 @@ public function __construct(Connection $connection) {
    */
   public static function create(ContainerInterface $container) {
     return new static(
-      $container->get('database')
+      $container->get('entity.manager')->getStorageController('taxonomy_term')
     );
   }
 
@@ -78,11 +81,7 @@ public function getConfirmText() {
    * {@inheritdoc}
    */
   public function save(array $form, array &$form_state) {
-    $this->connection->update('taxonomy_term_data')
-      ->fields(array('weight' => 0))
-      ->condition('vid', $this->entity->id())
-      ->execute();
-
+    $this->termStorage->resetWeights($this->entity->id());
     drupal_set_message($this->t('Reset vocabulary %name to alphabetical order.', array('%name' => $this->entity->label())));
     watchdog('taxonomy', 'Reset vocabulary %name to alphabetical order.', array('%name' => $this->entity->label()), WATCHDOG_NOTICE);
     $form_state['redirect'] = 'admin/structure/taxonomy/manage/' . $this->entity->id();
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/TermStorageController.php b/core/modules/taxonomy/lib/Drupal/taxonomy/TermStorageController.php
index f77b1b5..eed77a8 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/TermStorageController.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/TermStorageController.php
@@ -82,4 +82,73 @@ public function updateTermHierarchy(EntityInterface $term) {
     $query->execute();
   }
 
+  /**
+   * {@inheritdoc}
+   */
+  public function loadParents($tid) {
+    $query = $this->database->select('taxonomy_term_data', 't');
+    $query->join('taxonomy_term_hierarchy', 'h', 'h.parent = t.tid');
+    $query->addField('t', 'tid');
+    $query->condition('h.tid', $tid);
+    $query->addTag('term_access');
+    $query->orderBy('t.weight');
+    $query->orderBy('t.name');
+    return $query->execute()->fetchCol();
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function loadChildren($tid, $vid = NULL) {
+    $query = $this->database->select('taxonomy_term_data', 't');
+    $query->join('taxonomy_term_hierarchy', 'h', 'h.tid = t.tid');
+    $query->addField('t', 'tid');
+    $query->condition('h.parent', $tid);
+    if ($vid) {
+      $query->condition('t.vid', $vid);
+    }
+    $query->addTag('term_access');
+    $query->orderBy('t.weight');
+    $query->orderBy('t.name');
+    return $query->execute()->fetchCol();
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function loadTree($vid) {
+    $query = $this->database->select('taxonomy_term_data', 't');
+    $query->join('taxonomy_term_hierarchy', 'h', 'h.tid = t.tid');
+    return $query
+      ->addTag('term_access')
+      ->fields('t')
+      ->fields('h', array('parent'))
+      ->condition('t.vid', $vid)
+      ->orderBy('t.weight')
+      ->orderBy('t.name')
+      ->execute();
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function nodeCount($vid) {
+    $query = $this->database->select('taxonomy_index', 'ti');
+    $query->addExpression('COUNT(DISTINCT ti.nid)');
+    $query->leftJoin('taxonomy_term_data', 'td', 'ti.tid = td.tid');
+    $query->condition('td.vid', $vid);
+    $query->addTag('vocabulary_node_count');
+    return $query->execute()->fetchField();
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function resetWeights($vid) {
+    $this->database->update('taxonomy_term_data')
+      ->fields(array('weight' => 0))
+      ->condition('vid', $vid)
+      ->execute();
+  }
+
 }
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/TermStorageControllerInterface.php b/core/modules/taxonomy/lib/Drupal/taxonomy/TermStorageControllerInterface.php
index 732a58f..7941c46 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/TermStorageControllerInterface.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/TermStorageControllerInterface.php
@@ -18,7 +18,7 @@
   /**
    * Removed reference to terms from term_hierarchy.
    *
-   * @param array
+   * @param array $tids
    *   Array of terms that need to be removed from hierarchy.
    */
   public function deleteTermHierarchy($tids);
@@ -31,4 +31,58 @@ public function deleteTermHierarchy($tids);
    */
   public function updateTermHierarchy(EntityInterface $term);
 
+  /**
+   * Finds all parents of a given term ID.
+   *
+   * @param int $tid
+   *   Term id to retrieve parents for.
+   *
+   * @return array
+   *   An array of term objects which are the parents of the term $tid.
+   */
+  public function loadParents($tid);
+
+  /**
+   * Finds all children of a term ID.
+   *
+   * @param int $tid
+   *   Term id to retrieve parents for.
+   * @param string $vid
+   *   An optional vocabulary ID to restrict the child search.
+   *
+   * @return array
+   *   An array of term objects that are the children of the term $tid.
+   */
+  public function loadChildren($tid, $vid = NULL);
+
+  /**
+   * Finds all terms in a given vocabulary ID.
+   *
+   * @param string $vid
+   *   Vocabulary ID to retrieve terms for.
+   *
+   * @return array
+   *   An array of term objects that are the children of the vocabulary $vid.
+   */
+  public function loadTree($vid);
+
+  /**
+   * Count the number of nodes in a given vocabulary ID.
+   *
+   * @param string $vid
+   *   Vocabulary ID to retrieve terms for.
+   *
+   * @return int
+   *   A count of the nodes in a given vocabulary ID.
+   */
+  public function nodeCount($vid);
+
+  /**
+   * Reset the weights for a given vocabulary ID.
+   *
+   * @param string $vid
+   *   Vocabulary ID to retrieve terms for.
+   */
+  public function resetWeights($vid);
+
 }
diff --git a/core/modules/taxonomy/taxonomy.module b/core/modules/taxonomy/taxonomy.module
index 0827bef..07da685 100644
--- a/core/modules/taxonomy/taxonomy.module
+++ b/core/modules/taxonomy/taxonomy.module
@@ -522,14 +522,7 @@ function taxonomy_term_load_parents($tid) {
   $parents = &drupal_static(__FUNCTION__, array());
 
   if ($tid && !isset($parents[$tid])) {
-    $query = db_select('taxonomy_term_data', 't');
-    $query->join('taxonomy_term_hierarchy', 'h', 'h.parent = t.tid');
-    $query->addField('t', 'tid');
-    $query->condition('h.tid', $tid);
-    $query->addTag('term_access');
-    $query->orderBy('t.weight');
-    $query->orderBy('t.name');
-    $tids = $query->execute()->fetchCol();
+    $tids = \Drupal::entityManager()->getStorageController('taxonomy_term')->loadParents($tid);
     $parents[$tid] = entity_load_multiple('taxonomy_term', $tids);
   }
 
@@ -577,17 +570,7 @@ function taxonomy_term_load_children($tid, $vid = NULL) {
   $children = &drupal_static(__FUNCTION__, array());
 
   if ($tid && !isset($children[$tid])) {
-    $query = db_select('taxonomy_term_data', 't');
-    $query->join('taxonomy_term_hierarchy', 'h', 'h.tid = t.tid');
-    $query->addField('t', 'tid');
-    $query->condition('h.parent', $tid);
-    if ($vid) {
-      $query->condition('t.vid', $vid);
-    }
-    $query->addTag('term_access');
-    $query->orderBy('t.weight');
-    $query->orderBy('t.name');
-    $tids = $query->execute()->fetchCol();
+    $tids = \Drupal::entityManager()->getStorageController('taxonomy_term')->loadChildren($tid);
     $children[$tid] = entity_load_multiple('taxonomy_term', $tids);
   }
 
@@ -628,16 +611,7 @@ function taxonomy_get_tree($vid, $parent = 0, $max_depth = NULL, $load_entities
     $parents[$vid] = array();
     $terms[$vid] = array();
 
-    $query = db_select('taxonomy_term_data', 't');
-    $query->join('taxonomy_term_hierarchy', 'h', 'h.tid = t.tid');
-    $result = $query
-      ->addTag('term_access')
-      ->fields('t')
-      ->fields('h', array('parent'))
-      ->condition('t.vid', $vid)
-      ->orderBy('t.weight')
-      ->orderBy('t.name')
-      ->execute();
+    $result = \Drupal::entityManager()->getStorageController('taxonomy_term')->loadTree($vid);
 
     foreach ($result as $term) {
       $children[$vid][$term->parent][] = $term->tid;
diff --git a/core/modules/taxonomy/taxonomy.tokens.inc b/core/modules/taxonomy/taxonomy.tokens.inc
index 308f66c..0891faa 100644
--- a/core/modules/taxonomy/taxonomy.tokens.inc
+++ b/core/modules/taxonomy/taxonomy.tokens.inc
@@ -167,21 +167,15 @@ function taxonomy_tokens($type, $tokens, array $data = array(), array $options =
           break;
 
         case 'term-count':
-          $query = db_select('taxonomy_term_data');
-          $query->condition('vid', $vocabulary->id());
-          $query->addTag('vocabulary_term_count');
-          $count = $query->countQuery()->execute()->fetchField();
-          $replacements[$original] = $count;
+          $replacements[$original] = \Drupal::entityQuery('taxonomy_term')
+            ->condition('vid', $vocabulary->id())
+            ->addTag('vocabulary_term_count')
+            ->count()
+            ->execute();
           break;
 
         case 'node-count':
-          $query = db_select('taxonomy_index', 'ti');
-          $query->addExpression('COUNT(DISTINCT ti.nid)');
-          $query->leftJoin('taxonomy_term_data', 'td', 'ti.tid = td.tid');
-          $query->condition('td.vid', $vocabulary->id());
-          $query->addTag('vocabulary_node_count');
-          $count = $query->execute()->fetchField();
-          $replacements[$original] = $count;
+          $replacements[$original] = \Drupal::entityManager()->getStorageController('taxonomy_term')->nodeCount($vocabulary->id());
           break;
       }
     }
