public function removeEntityBundle($content_entity_type, $config_entity_type, $bundle, $field = 'type') {
    $content_removed = FALSE;
    if ($content_entity_type) {
      // Remove existing data of content entity.
      $query = $this->entityTypeManager
        ->getStorage($content_entity_type)
        ->getQuery('AND')
        ->condition($field, $bundle);

      $ids = $query->execute();
      $content_removed = $this->removeContent($content_entity_type, $config_entity_type, $bundle, $ids);
    }

    if ($config_entity_type && $content_removed) {
      // Remove bundle.
      $config_entity_type_bundle = $this->entityTypeManager
        ->getStorage($config_entity_type)
        ->load($bundle);
      if ($config_entity_type_bundle) {
        try {
          $config_entity_type_bundle->delete();
        }
        catch (\Exception $e) {
          watchdog_exception('openy', $e, "Error! Can't delete config entity 
          @config_entity_type bundle <b>@bundle</b>, please @remove.", [
            '@config_entity_type' => $config_entity_type,
            '@bundle' => $bundle,
            '@remove' => $this->getLink($config_entity_type, 'remove it manually', $bundle),
          ], RfcLogLevel::NOTICE);
        }
      }
    }
  }