@Override
  public ModelAndView execute(HttpServletRequest request, HttpServletResponse response)
      throws Exception {
    QuestionDao questionDao = QuestionDao.getInstance();
    AnswerDao answerDao = AnswerDao.getInstance();

    int questionId = ServletRequestUtils.getIntParameter(request, "questionId", -1);
    if (questionId == -1) {
      throw new RuntimeException();
    }

    Question question = questionDao.findById(questionId);
    List<Answer> answers = answerDao.findAllByQuestionId(questionId);

    if (question.getCountOfComment() == 0) {
      questionDao.delete(questionId);
    } else if (isAllWriterSame(answers, question.getWriter())) {
      questionDao.delete(questionId);
    } else {
      // 삭제가 안될 경우 처리
    }

    ModelAndView mav = jsonView();

    return mav;
  }
  @Override
  public ModelAndView execute(HttpServletRequest request, HttpServletResponse response)
      throws Exception {
    QuestionDao questionDao = QuestionDao.getInstance();
    List<Question> questions =
        questionDao.findAllByPage(
            ServletRequestUtils.getRequiredIntParameter(request, "pageNumber"));

    ModelAndView mav = jsonView();
    mav.addObject("questions", questions);

    return mav;
  }