public PagedResult<DiffComment> readDiffComments(String source) throws ReviewboardException {

    try {
      JSONObject object = checkedGetJSonRootObject(source);

      int totalResults = object.getInt("total_results");
      JSONArray jsonDiffComments = object.getJSONArray("diff_comments");

      List<DiffComment> diffComments = new ArrayList<DiffComment>();
      for (int i = 0; i < jsonDiffComments.length(); i++) {
        JSONObject jsonDiffComment = jsonDiffComments.getJSONObject(i);
        DiffComment comment = new DiffComment();

        mapComment(jsonDiffComment, comment);
        comment.setFirstLine(jsonDiffComment.getInt("first_line"));
        comment.setNumLines(jsonDiffComment.getInt("num_lines"));
        String fileHref =
            jsonDiffComment.getJSONObject("links").getJSONObject("filediff").getString("href");
        int fileId = Integer.parseInt(fileHref.replaceFirst(".*files/", "").replace("/", ""));
        comment.setFileId(fileId);

        diffComments.add(comment);
      }

      return PagedResult.create(diffComments, totalResults);

    } catch (JSONException e) {
      throw new ReviewboardException(e.getMessage(), e);
    }
  }
  private DiffComment mapDiffComment(JSONObject jsonDiffComment) throws JSONException {

    DiffComment comment = new DiffComment();

    mapComment(jsonDiffComment, comment);
    comment.setFirstLine(jsonDiffComment.getInt("first_line"));
    comment.setNumLines(jsonDiffComment.getInt("num_lines"));
    String fileHref =
        jsonDiffComment.getJSONObject("links").getJSONObject("filediff").getString("href");
    int fileId = Integer.parseInt(fileHref.replaceFirst(".*files/", "").replace("/", ""));
    comment.setFileId(fileId);

    return comment;
  }