code: public function onDelete(ResourceEventInterface $event)
      {
          $attachment = $this->getAttachmentFromEvent($event);
  
          if (null === $message = $attachment->getMessage()) {
              $message = $this->persistenceHelper->getChangeSet($attachment, 'message')[0];
          }
  
          $this->updateMessage($message);
      }
docs: Delete event handler.
  
  @param ResourceEventInterface $event