code: public function preRemove(LifecycleEventArgs $args)
      {
          $entity = $args->getObject();
          if ($entity instanceof ResourceInterface) {
              $this->resourceManager->removeResourceFile($entity);
  
              return;
          }
      }
docs: @param LifecycleEventArgs $args
  
  @throws \UnexpectedValueException