public JSONObject getAllExistingTasksWithGlobalId() {
   JSONObject existingTasks = new JSONObject();
   ArrayList<Task> tasks = tasksManager.getAllTasks();
   for (Task task : tasks) {
     if (task.getGlobalId() != 0) {
       try {
         existingTasks.put(Long.toString(task.getGlobalId()), Long.toString(task.getId()));
       } catch (JSONException e) {
         Log.e(TAG, "Cannot create JSONObject with existing tasks that have globalId");
         e.printStackTrace();
       }
     }
   }
   return existingTasks;
 }