@RequestMapping(method = RequestMethod.GET)
  @ResponseBody
  public Map<String, Object> listMessages(
      @RequestParam(value = "since", defaultValue = "") String since) {
    final Map<String, Object> response = new HashMap<String, Object>();
    final List<MessageDto> messageList = new ArrayList<MessageDto>();
    final List<Message> list = messageDao.listBySubject(null, null, since);
    final RestStatusDto statusDto = new RestStatusDto();

    if (list != null) {
      final String newSince = MessageDao.getCursor(list);

      for (Message m : list) {
        final MessageDto dto = new MessageDto();
        DtoMarshaller.copyToDto(m, dto);
        messageList.add(dto);
      }

      statusDto.setSince(newSince);
      statusDto.setNum(list.size());
    }
    response.put("meta", statusDto);
    response.put("messages", messageList);
    return response;
  }
  @RequestMapping(method = RequestMethod.GET, value = "/{id}")
  @ResponseBody
  public Map<String, MessageDto> getMessage(@PathVariable("id") Long id) {
    final Map<String, MessageDto> response = new HashMap<String, MessageDto>();
    final MessageDto dto = new MessageDto();
    final Message m = messageDao.getByKey(id);

    if (m != null) {
      DtoMarshaller.copyToDto(m, dto);
    }
    response.put("message", dto);
    return response;
  }