public function getService(LifecycleEventArgs $args)
    {
        $service = $args->getObject();

        if (!$service) {
            throw new \Exception('Please set a provider on the entity before persisting any media');
        }

        return $this->getBlockManager()->getService($service);
    }