@Override
  public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
    Log.i(TAG, "response123=" + response);
    ArrayList<T> models = new ArrayList<T>();
    boolean isSuccess;
    try {
      isSuccess = response.getBoolean("isSuccess");
      String message = response.getString("message");
      if (isSuccess) {
        String jsonObjectData = response.getString("data");
        Log.i(TAG, "jsonObjectData=" + jsonObjectData);
        JSONArray jsona = new JSONArray(jsonObjectData);
        for (int j = 0; j < jsona.length(); j++) {
          JSONObject jsonObjitem = jsona.getJSONObject(j);
          T obj = (T) Class.forName(c.getName()).newInstance();
          obj.parse(jsonObjitem);
          if (obj != null) models.add(obj);
        }
        PersistenceHelper.saveModelList(context, models, key);
        SafeHandler.onSuccess(handler, models);
      } else {
        SafeHandler.onFailure(handler, message);
      }
    } catch (Exception e) {

    }
  }
 @Override
 public void onSuccess(int statusCode, Header[] headers, JSONArray response) {
   ArrayList<T> models = new ArrayList<T>();
   for (int i = 0; i < response.length(); i++) {
     try {
       JSONObject jsonObj = response.getJSONObject(i);
       Log.i(TAG, "jsonObj=" + jsonObj);
       T obj = (T) Class.forName(c.getName()).newInstance();
       obj.parse(jsonObj);
       if (obj != null) models.add(obj);
     } catch (Exception e) {
     }
   }
   PersistenceHelper.saveModelList(context, models, key);
   SafeHandler.onSuccess(handler, models);
 }
 private void handleFailure(int statusCode, String error) {
   Log.i(TAG, "statusCode4=" + statusCode);
   error = ErrorType.errorMessage(context, ErrorType.ErrorApiForbidden);
   SafeHandler.onFailure(handler, error);
 }