protected function retrieveOr404($entityId, $loaderId)
    {
        if (!$this->container->has($loaderId)) {
            throw new NotFoundHttpException(sprintf('Unknow required loader : "%s"',
                $loaderId
            ));
        }

        if (!$entity = $this->container->get($loaderId)->retrieve($entityId)) {
            throw $this->create404($entityId, $loaderId);
        }

        return $entity;
    }