@RequestMapping("/")
  public String home(
      Model model, HttpSession session, Integer id, @RequestParam(defaultValue = "0") int page) {
    String username = (String) session.getAttribute("username");
    if (username == null) {
      return "login";
    }
    PageRequest pr = new PageRequest(page, 4);
    Page current;

    if (id != null) {
      current = appointments.findOneById(pr, id);
    } else {
      current = appointments.findAll(pr);
    }

    model.addAttribute("nextPage", page + 1);
    model.addAttribute("id", current);
    model.addAttribute("showNext", current.hasNext());
    model.addAttribute("appointments", current);

    return "home";
  }