public function serialize($entity)
    {
        if (!$this->container->has('hydra.serializer')) {
            throw new \LogicException('The HydraBundle is not registered in your application.');
        }

        return $this->container->get('hydra.serializer')->serialize($entity, self::FORMAT);
    }