@RequestMapping(value = "/{id}" + Urls.DELETE, method = RequestMethod.GET)
 public String delete(@PathVariable long id, Model model) {
   if (brickFacade.getBrick(id) == null) {
     throw new ResourceNotFoundException();
   }
   brickFacade.removeBrick(id);
   return "redirect:/brick";
 }
  @RequestMapping(value = "/{id}" + Urls.EDIT, method = RequestMethod.GET)
  public String edit(@PathVariable long id, Model model) {
    BrickDto brickDto = brickFacade.getBrick(id);
    if (brickDto == null) {
      throw new ResourceNotFoundException();
    }

    model.addAttribute("brick", brickDto);

    return "bricks/form";
  }
 @RequestMapping(value = Urls.CREATE, method = RequestMethod.POST)
 public String createProcess(
     @Valid @ModelAttribute("brick") BrickDto brickDto, BindingResult bindingResult) {
   brickValidator.validate(brickDto, bindingResult);
   if (!bindingResult.hasErrors()) {
     brickFacade.createBrick(brickDto);
     return "redirect:";
   } else {
     return "bricks/form";
   }
 }
 @RequestMapping(value = "/{id}" + Urls.EDIT, method = RequestMethod.POST)
 public String editProcess(
     @PathVariable long id,
     @Valid @ModelAttribute("brick") BrickDto brickDto,
     BindingResult bindingResult) {
   brickDto.setId(id);
   brickValidator.validate(brickDto, bindingResult);
   if (!bindingResult.hasErrors()) {
     brickFacade.editBrick(brickDto);
     return "redirect:";
   } else {
     return "bricks/form";
   }
 }
 @RequestMapping(value = Urls.MOST_USED + "/{amount}", method = RequestMethod.GET)
 public String getMostUsed(@PathVariable int amount, Model model) {
   model.addAttribute("bricks", brickFacade.getMostUsedBricks(amount));
   return "bricks/list";
 }
 @RequestMapping(value = Urls.UNUSED, method = RequestMethod.GET)
 public String getUnused(Model model) {
   model.addAttribute("bricks", brickFacade.getUnusedBricks());
   return "bricks/list";
 }
 @RequestMapping(method = RequestMethod.GET)
 public String getAll(Model model) {
   model.addAttribute("bricks", brickFacade.getAllBricks());
   return "bricks/list";
 }