public function validate($entity)
    {
        if (!$this->container->has('validator')) {
            throw new \LogicException('The validator service is not available.');
        }

        $errors = $this->container->get('validator')->validate($entity);

        if (count($errors) === 0) {
            return false;
        }

        // TODO Use Hydra Error instead
        return new JsonLdResponse('{ "error": "Validation error" }', 400);
    }