@RequestMapping(value = "/api/todo/{id}", method = RequestMethod.GET)
  @ResponseBody
  public TodoDTO findById(@PathVariable("id") Long id) throws TodoNotFoundException {
    LOGGER.debug("Finding to-do entry with id: {}", id);

    Todo found = service.findById(id);
    LOGGER.debug("Found to-do entry with information: {}", found);

    return createDTO(found);
  }
  @RequestMapping(value = "/api/todo/{id}", method = RequestMethod.DELETE)
  @ResponseBody
  public TodoDTO deleteById(@PathVariable("id") Long id) throws TodoNotFoundException {
    LOGGER.debug("Deleting a to-do entry with id: {}", id);

    Todo deleted = service.deleteById(id);
    LOGGER.debug("Deleted to-do entry with information: {}", deleted);

    return createDTO(deleted);
  }
  @RequestMapping(value = "/api/todo", method = RequestMethod.GET)
  @ResponseBody
  public List<TodoDTO> findAll() {
    LOGGER.debug("Finding all todo entries.");

    List<Todo> models = service.findAll();
    LOGGER.debug("Found {} to-do entries.", models.size());

    return createDTOs(models);
  }
  @RequestMapping(value = "/api/todo", method = RequestMethod.POST)
  @ResponseBody
  public TodoDTO add(@Valid @RequestBody TodoDTO dto) {
    LOGGER.debug("Adding a new to-do entry with information: {}", dto);

    Todo added = service.add(dto);
    LOGGER.debug("Added a to-do entry with information: {}", added);

    return createDTO(added);
  }
  @RequestMapping(value = "/api/todo/{id}", method = RequestMethod.PUT)
  @ResponseBody
  public TodoDTO update(@Valid @RequestBody TodoDTO dto, @PathVariable("id") Long todoId)
      throws TodoNotFoundException {
    LOGGER.debug("Updating a to-do entry with information: {}", dto);

    Todo updated = service.update(dto);
    LOGGER.debug("Updated the information of a to-entry to: {}", updated);

    return createDTO(updated);
  }