code: @Override
      @PreAuthorize("hasRole(@configHolder.getSuperAdminRoleName()) or hasPermission(#plugin, 'DELETE')")
      public void delete(E plugin) {
          if (applicationService == null) {
              LOG.error("Plugin cannot be deleted, failed to autowire application service");
              return;
          }
  
          List<Application> apps = applicationService.findAllWithCollectionContaining("plugins", plugin);
          Integer pluginId = plugin.getId();
          for (Application app : apps) {
              List<Plugin> plugins = app.getPlugins();
              if (plugins != null && plugins.contains(plugin)) {
                  String msg = String.format(
                      "Remove plugin (id=%s) from application (id=%s)",
                      pluginId, app.getId()
                  );
                  LOG.debug(msg);
                  plugins.remove(plugin);
                  // TODO will this use the the PreAuthorize annotations of AbstractCrudService wrt WRITE on the app?
                  applicationService.saveOrUpdate(app);
              }
          }
          LOG.debug(String.format("Delete plugin (id=%s)", pluginId));
          // call overridden parent to actually delete the entity itself
          super.delete(plugin);
      }
docs: Removes the passed plugin from all applications and afterwards deletes the plugin itself. This overrides the
  generic method to delete {@link AbstractCrudService#delete(de.terrestris.shoguncore.model.PersistentObject)}.
  
  @param plugin