/**
  * Returns the {@link org.json.JSONObject} from within the json array.
  *
  * @param index
  * @return
  */
 public JSONObject getJSONObject(int index) {
   JSONObject jsonObject = null;
   try {
     jsonObject = jsonArray.getJSONObject(index);
   } catch (JSONException e) {
     FlowLog.logError(e);
   }
   return jsonObject;
 }
  /**
   * Retrieves the {@link org.json.JSONObject} at the specified index and checks if it exists
   *
   * @param index The valid index
   * @return true if the json object at the specified index exists, false if it's an invalid index
   *     or does not exist.
   */
  public boolean exists(int index) {
    boolean exists = false;
    try {
      exists = new JSONModel<>(jsonArray.getJSONObject(index), table).exists();
    } catch (JSONException e) {
      FlowLog.logError(e);
    }

    return exists;
  }
 @Override
 public void save() {
   if (jsonArray != null && jsonArray.length() > 0) {
     int length = jsonArray.length();
     JSONModel<ModelClass> jsonModel = new JSONModel<>(table);
     for (int i = 0; i < length; i++) {
       try {
         jsonModel.data = jsonArray.getJSONObject(i);
         jsonModel.save();
       } catch (JSONException e) {
         FlowLog.logError(e);
       }
     }
   }
 }