/**
  * @inheritdoc
  */
 protected function handle(PanelsDisplayVariant $panels_display, $decoded_request, $save_to_temp_store = FALSE)
 {
     $panels_display->removeBlock($decoded_request);
     if ($save_to_temp_store) {
         $this->savePanelsDisplayToTempStore($panels_display);
     } else {
         $this->savePanelsDisplay($panels_display);
     }
 }
 /**
  * Updates the current Panels display based on the changes done in our app.
  *
  * @param \Drupal\panels\Plugin\DisplayVariant\PanelsDisplayVariant $panels_display
  *   The current Panels display.
  * @param array $layout_model
  *   The decoded LayoutModel from our App.
  *
  * @return \Symfony\Component\HttpFoundation\JsonResponse
  */
 protected function updatePanelsDisplay(PanelsDisplayVariant $panels_display, array $layout_model)
 {
     // Set our weight and region based on the metadata in our Backbone app.
     foreach ($layout_model['regionCollection'] as $region) {
         $weight = 0;
         foreach ($region['blockCollection'] as $block) {
             /** @var \Drupal\Core\Block\BlockBase $block_instance */
             $block_instance = $panels_display->getBlock($block['uuid']);
             $block_instance->setConfigurationValue('region', $region['name']);
             $block_instance->setConfigurationValue('weight', ++$weight);
             $panels_display->updateBlock($block['uuid'], $block_instance->getConfiguration());
         }
     }
     // Remove blocks that need removing.
     // @todo We should do this on the fly instead of at on save.
     foreach ($layout_model['deletedBlocks'] as $uuid) {
         $panels_display->removeBlock($uuid);
     }
     // Save the variant and remove temp storage.
     $this->savePanelsDisplay($panels_display, FALSE);
     return new JsonResponse(['deletedBlocks' => []]);
 }