public async Task <IActionResult> CreateAnswerSubmit(Guid id, IFormCollection collection, AnswerCreateViewModel answer, bool createSingleAnswer)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest());
                }
                string uniqueFileName = null;
                if (answer.Foto != null)
                {
                    string uploadsFolder = Path.Combine(hostingEnvironment.WebRootPath, "images");
                    uniqueFileName = Guid.NewGuid().ToString() + "_" + answer.Foto.FileName;
                    string filePath = Path.Combine(uploadsFolder, uniqueFileName);
                    answer.Foto.CopyTo(new FileStream(filePath, FileMode.Create));
                }
                Answer newAnswer = new Answer
                {
                    Id          = Guid.NewGuid(),
                    Description = answer.Description,
                    FotoURL     = uniqueFileName
                };

                if (answer.Correct.ToString() == "True")
                {
                    newAnswer.Correct = Answer.IsCorrect.True;
                }
                else
                {
                    newAnswer.Correct = Answer.IsCorrect.False;
                }

                newAnswer.QuestionId = id;
                Question question = await quizRepo.GetQuestionForIdAsync(id);

                if (question == null || id == Guid.Empty)
                {
                    return(RedirectToAction(nameof(Quizzes), new { exc = "Wrong QuestionId" }));
                }
                newAnswer.Question = question;
                var created = await quizRepo.AddAnswer(newAnswer);

                if (created == null)
                {
                    return(RedirectToAction(nameof(Quizzes), new { exc = "Answer failed to create" }));
                }

                if (createSingleAnswer)
                {
                    return(RedirectToAction(nameof(QuestionAnswers), new { id = question.Id, QuizId = question.QuizId, QuestionName = question.Description }));
                }

                IEnumerable <Answer> answers = await quizRepo.GetAllAnswersByQuestionId(id);

                var answerCount = answers.Count();
                if (answerCount == 10)
                {
                    return(RedirectToAction(nameof(QuizQuestions), new { id = question.QuizId }));
                }
                else
                {
                    return(RedirectToAction(nameof(CreateAnswer), new { id = id, QuizId = question.QuizId }));
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Create is giving an error: " + ex.Message);
                return(View());
            }
        }