Delete a block of all layouts I am using Layout Builder (Drupal 8.7.1)

I have a block in several Layouts. How can I programmatically remove all instances of this block and update all layouts without the message "This block is broken or missing. You may be missing content or you might need to enable the original module." ?
here it is, tried it with a custom content block and a views block

i executed the code in php/devel from devel_php module

$storage = \Drupal::entityTypeManager()-&gt;getStorage('entity_view_display');
foreach ($storage-&gt;loadMultiple() as $display) {
  foreach ($display-&gt;getSections() as $section) {
    foreach ($section-&gt;getComponents() as $component) {
      // Custom views block
      // $to_delete_plugin_id = 'views_block:my_news-block_1';
      // Custom block
      $to_delete_plugin_id = 'block_content:fb4ad848-0f3c-4296-a6ba-1a9da886335b';
      if ($component-&gt;getPluginId() == $to_delete_plugin_id) {
        $section-&gt;removeComponent($component-&gt;getUuid());
        $display-&gt;save();
      }
    }
  }
}


for a particular node :

// This can be adapted to be used for a set of nodes
$node = node_load(42);
$display = $node-&gt;layout_builder__layout;

foreach ($display-&gt;getSections() as $section) {
  foreach ($section-&gt;getComponents() as $component) {
    // Custom views block
    // $to_delete_plugin_id = 'views_block:my_news-block_1';
    // Custom block
    $to_delete_plugin_id = 'block_content:fb4ad848-0f3c-4296-a6ba-1a9da886335b';
    if ($component-&gt;getPluginId() == $to_delete_plugin_id) {
      $section-&gt;removeComponent($component-&gt;getUuid());
      $node-&gt;save();
    }
  }
} 


Hope this helps :)