public function getProvider(LifecycleEventArgs $args)
    {
        $provider = $args->getObject()->getProvider();

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

        return $this->container->get('opifer.media.provider.pool')->getProvider($provider);
    }