@RequestMapping(value = "/admin/user/save", method = RequestMethod.POST)
  public String saveUser(
      @ModelAttribute("user") User user, BindingResult result, Model model, HttpSession session) {

    userService.save(user);

    try {
      if (user.getDateCreated() == null) user.setDateCreated(new Date());
      user.setLastUpdated(new Date());

      userService.save(user);
    } catch (RuntimeException re) {
      pageFrameworkService.setFlashMessage(session, re.getMessage());
      pageFrameworkService.setIsRedirect(session, Boolean.TRUE);
      return "redirect:/admin/user/list";
    }
    return "redirect:/admin/user/list";
  }
  @RequestMapping(value = "/admin/user/delete/{id}")
  public String deleteUser(@PathVariable("id") int id, HttpSession session) {

    User user = userService.findEntityById(id);
    if (user != null) {
      try {
        userService.delete(user);
      } catch (RuntimeException re) {
        pageFrameworkService.setFlashMessage(session, re.getMessage());
        pageFrameworkService.setIsRedirect(session, Boolean.TRUE);
        return "redirect:/admin/user/show/" + id;
      }
    } else {
      pageFrameworkService.setFlashMessage(session, "No User with that id");
      pageFrameworkService.setIsRedirect(session, Boolean.TRUE);
    }
    return "redirect:/admin/user/list";
  }
  @RequestMapping(value = "/admin/user/edit/{id}", method = RequestMethod.GET)
  public ModelAndView edit(@PathVariable int id) {

    User user = userService.findEntityById(id);

    ModelAndView modelAndView = new ModelAndView("admin/user/edit");
    modelAndView.addObject("command", user);

    return modelAndView;
  }
  @RequestMapping(value = "/admin/user/show/{userId}", method = RequestMethod.GET)
  public String showUser(@PathVariable("userId") int userId, Model model) {

    User user = userService.findEntityById(userId);

    if (user != null) {
      model.addAttribute(user);
      return "admin/user/show";
    } else {
      return "redirect:/admin/user/list";
    }
  }