public async Task <Answer> Update(Answer answer)
        {
            var answerToUpdate = await _db.Answers
                                 .SingleAsync(t => t.Id == answer.Id);

            if (answerToUpdate == null)
            {
                throw new NotFoundException(nameof(Answer), answer.Id);
            }

            answerToUpdate.QuestionId = answer.QuestionId;
            answerToUpdate.Body       = answer.Body;
            answerToUpdate.UpdatedOn  = DateTime.UtcNow;

            _db.Update(answerToUpdate);

            await _db.SaveChangesAsync();

            return(answerToUpdate);
        }
        public async Task <Question> Update(Question question)
        {
            var questionToUpdate = await _db.Questions
                                   .SingleAsync(t => t.Id == question.Id);

            if (questionToUpdate == null)
            {
                throw new NotFoundException(nameof(Question), question.Id);
            }

            questionToUpdate.Title     = question.Title;
            questionToUpdate.Body      = question.Body;
            questionToUpdate.UpdatedOn = DateTime.UtcNow;

            _db.Update(questionToUpdate);

            await _db.SaveChangesAsync();

            return(questionToUpdate);
        }