@Transactional(rollbackForClassName = "java.lang.Exception")
  @RequestMapping(
      value = "updateMyPage",
      method = {RequestMethod.POST})
  public ModelAndView updateMyPage(
      @Valid UserProfile userProfile, BindingResult result, HttpServletRequest request)
      throws IllegalRequestException {

    Integer authUserId = userCookieGenerator.getUserId(request);
    if (!authUserId.equals(userProfile.getUserId())) throw new IllegalRequestException();

    try {
      if (result.hasErrors()) {
        throw new InvalidInputException();
      }
      if (!userProfile.validForEditingProfile()) {
        Map<String, String> rejectValueMap = userProfile.getRejectValueMap();
        for (Map.Entry<String, String> entry : rejectValueMap.entrySet()) {
          result.rejectValue(entry.getKey(), entry.getValue());
        }
        throw new InvalidInputException();
      }
    } catch (InvalidInputException e) {
      ModelAndView modelAndView = new ModelAndView();
      modelAndView.addObject(
          "userProfileDisplay", userProfileMapper.getUserProfileById(authUserId));
      modelAndView.addObject("userProfile", userProfile);
      modelAndView.addObject("userStickyList", userStickyMapper.listByUserId(authUserId));
      modelAndView.addObject("editMode", true);
      modelAndView.setViewName("user/show");
      return modelAndView;
    }

    userProfileMapper.updateUserProfile(userProfile);
    userProfile = userProfileMapper.getUserProfileById(authUserId);

    ModelAndView modelAndView = new ModelAndView();
    modelAndView.addObject("userProfileDisplay", userProfile);
    modelAndView.addObject("userProfile", userProfile);
    modelAndView.addObject("userStickyList", userStickyMapper.listByUserId(authUserId));
    modelAndView.addObject("editMode", true);
    modelAndView.addObject("updated", true);
    modelAndView.setViewName("user/show");
    return modelAndView;
  }
  @Transactional(rollbackForClassName = "java.lang.Exception")
  @RequestMapping(value = "updateProfile", method = RequestMethod.POST)
  public ModelAndView updateProfile(
      @Valid UserProfile userProfile, BindingResult result, HttpServletRequest request)
      throws IllegalRequestException {

    if (!userCookieGenerator.getUserId(request).equals(userProfile.getUserId()))
      throw new IllegalRequestException();

    try {
      if (result.hasErrors()) {
        throw new InvalidInputException();
      }
      if (!userProfile.validForEditingProfile()) {
        Map<String, String> rejectValueMap = userProfile.getRejectValueMap();
        for (Map.Entry<String, String> entry : rejectValueMap.entrySet()) {
          result.rejectValue(entry.getKey(), entry.getValue());
        }
        throw new InvalidInputException();
      }
    } catch (InvalidInputException e) {
      ModelAndView modelAndView = new ModelAndView();
      modelAndView.addObject("activeTab", "profile");
      modelAndView.addObject("userProfile", userProfile);
      modelAndView.setViewName("user/editProfile");
      return modelAndView;
    }

    userProfileMapper.updateUserProfile(userProfile);

    ModelAndView modelAndView = new ModelAndView();
    modelAndView.addObject("activeTab", "profile");
    modelAndView.addObject("updated", true);
    modelAndView.setViewName("user/edit");
    return modelAndView;
  }