How to delete a vocabulary terms programmatically? I want to remove all the terms from a vocab but not delete the vocab itself.

I can do it on the database, but Id rather use the api if available in D8. 

$existingTerms = \Drupal::entityTypeManager()-&gt;getStorage('taxonomy_term')-&gt;loadTree('mycustomvocab');
foreach ($existingTerms as $existingTerm) {
  // Delete vocabulary term *** This function is not available in D8 ***
  taxonomy_term_delete($existingTerm-&gt;tid);

  // Delete vocabulary - *** Not what is required ***
  /*
  $vocab = Vocabulary::load($existingTerm-&gt;vid);
  if (!is_null($vocab)) {
    $vocab-&gt;delete();
  }
  */
}


This is how Im doing it at the moment until I find a better solution

db_query("DELETE FROM {taxonomy_term_hierarchy} WHERE `tid` IN (SELECT tid FROM {taxonomy_term_data} WHERE `vid` = :ctype)", array(':ctype' =&gt; 'mycustomvocab'));  
db_query("DELETE FROM {taxonomy_term_field_data} WHERE `vid` = :ctype", array(':ctype' =&gt; 'mycustomvocab'));
db_query("DELETE FROM {taxonomy_term_data} WHERE `vid` = :ctype", array(':ctype' =&gt; 'mycustomvocab'));
$tids = \Drupal::entityQuery('taxonomy_term')
    -&gt;condition('vid', 'mycustomvocab')
    -&gt;execute();

  $controller = \Drupal::entityTypeManager()-&gt;getStorage('taxonomy_term');
  $entities = $controller-&gt;loadMultiple($tids);
  $controller-&gt;delete($entities);