public function respondAction(
        int $id,
        string $response,
        AuthorizationCheckerInterface $auth
    ): Response {
        // Get the repo and lookup the invitation.
        $repo = $this->em->getRepository(Invitation::class);
        if (null === $invitation = $repo->findOneBy(['id' => $id])) {
            throw new NotFoundHttpException();
        }

        // Check that this user is allowed to respond.
        if (!$auth->isGranted('respond', $invitation)) {
            throw new AccessDeniedException();
        }

        // Record response.
        switch ($response) {
            case 'accept':
                $invitation->setResponse(Invitation::RESPONSE_ACCEPT);
                break;
            case 'maybe':
                $invitation->setResponse(Invitation::RESPONSE_MAYBE);
                break;
            case 'decline':
                $invitation->setResponse(Invitation::RESPONSE_DECLINE);
                break;
        }
        $this->em->flush();

        // Return empty json response (code 200).
        return new JsonResponse();
    }