@RequestMapping(value = "/user/update/{id}", method = RequestMethod.GET)
 public ModelAndView getUserUpdateForm(@PathVariable("id") Long id) {
   LOGGER.debug("Getting user update form");
   ModelAndView mv = new ModelAndView("user_update");
   Optional<User> user = userService.getUserById(id);
   UserForm userForm = new UserForm(user.get());
   mv.addObject("form", userForm);
   return mv;
 }
 @RequestMapping(value = "/user/update", method = RequestMethod.POST)
 public String handleTeamUpdateForm(
     @Valid @ModelAttribute("form") UserForm form, BindingResult bindingResult) {
   LOGGER.debug("Processing user update form={}, bindingResult={}", form, bindingResult);
   if (bindingResult.hasErrors()) {
     // failed validation
     return "user_update";
   }
   try {
     userService.update(form);
   } catch (DataIntegrityViolationException e) {
     LOGGER.warn("Exception occurred when trying to save the user", e);
     return "user_update";
   }
   // ok, redirect
   return "redirect:/users";
 }