How do I delete all menu links from a menu using the menu machine name in Drupal 8 I trying to get the existing menu items and then delete them in bulk but I'm getting an error trying to load them.

$query = \Drupal::entityQuery('menu_link')
-&gt;condition('menu_name', 'mycustommenu')
// Order by weight so as to be helpful for menus that are only one level deep.
-&gt;sort('weight');
$result = $query-&gt;execute();


Drupal\Component\Plugin\Exception\PluginNotFoundException: The "menu_link" entity type does not exist. in Drupal\Core\Entity\EntityTypeManager-&gt;getDefinition() (line 125 of core/lib/Drupal/Core/Entity/EntityTypeManager.php).


Can someone suggest how I might do this better thanks.
$mids = \Drupal::entityQuery('menu_link_content')
  -&gt;condition('menu_name', 'browse')
  -&gt;sort('weight')
  -&gt;execute();

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