if (!latest.isEmpty()) {
JsonArray array = new JsonArray();
boolean startRecording = (latestId == 0l);
for (int i = latest.size() - 1; i >= 0; i--) {
Activity a = latest.get(i);
if (startRecording) {
JsonObject o = jsonService.convertToJson(a);
o.addProperty("isOwner", true);
array.add(jsonService.convertToJson(a));
}
// check whether to update status from here
if (a.getId().equals(latestId)) {
startRecording = true;
}
}
returnObj.add("statuses", array);