public int Gerar(int idCase, int idLicao, Usuario usuarioLogado)
        {
            AlunoDoCase alunoDoCase = _consultaDeAlunosService.ObterAlunoInscritoNoCase(usuarioLogado.Id, idCase);

            if (alunoDoCase == null)
            {
                throw new Exception("Usuário não está inscrito no case de negócio.");
            }

            Licao licao = _licaoRepository.GetById(idLicao);

            if (licao == null || licao.IdCase != idCase)
            {
                throw new Exception("Solicitação inválida.");
            }

            if (_consultaEntregaService.AlunoJaComecouAFazerALicao(alunoDoCase.Id, licao.Id))
            {
                throw new Exception("O registro de entrega desta lição já foi criado.");
            }

            EntregaDeLicao entrega = new EntregaDeLicao(licao);

            AdicionarResponsaveisPelaLicao(entrega, alunoDoCase);

            _entregaDeLicaoService.Manter(entrega);

            return(entrega.Id);
        }