@RequestMapping(value = "/manage/category/update.html", method = RequestMethod.POST)
  public String processSubmit(
      @ModelAttribute("category") TicketCategory category,
      BindingResult result,
      SessionStatus status,
      ModelMap map) {
    validator.validate(category, result);
    if (result.hasErrors()) {
      return MANAGE_TICKET_CATEGORY_EDIT;
    }

    // jeśli walidacja się powiedzie to można przystąpić do zapisania kategorii
    if (category.getTicketCategoryId() != null) {
      categoryDAO.updateCategory(category);
    } else {
      if (category.getParentCategory() != null) {
        TicketCategory parent =
            categoryDAO.getById(category.getParentCategory()); // TODO: parametr w URLu
        categoryDAO.insertCategory(category, parent);
      } else {
        categoryDAO.insertRootCategory(category);
      }
    }
    status.setComplete();
    return "redirect:/manage/category/" + category.getTicketCategoryId() + "/show.html";
  }
 @RequestMapping(value = "/manage/category/{id}/edit.html", method = RequestMethod.GET)
 public String prepareForm(@PathVariable("id") Long catId, ModelMap map) {
   map.addAttribute("category", categoryDAO.getById(catId));
   return MANAGE_TICKET_CATEGORY_EDIT;
 }