code: synchronized long storeUserProfile(String id, JSONObject obj) {
  
          if (id == null) return DB_UPDATE_ERROR;
  
          if (!this.belowMemThreshold()) {
              getConfigLogger().verbose("There is not enough space left on the device to store data, data discarded");
              return DB_OUT_OF_MEMORY_ERROR;
          }
  
          final String tableName = Table.USER_PROFILES.getName();
  
          long ret = DB_UPDATE_ERROR;
  
          try {
              final SQLiteDatabase db = dbHelper.getWritableDatabase();
              final ContentValues cv = new ContentValues();
              cv.put(KEY_DATA, obj.toString());
              cv.put("_id", id);
              ret = db.insertWithOnConflict(tableName, null, cv, SQLiteDatabase.CONFLICT_REPLACE);
          } catch (final SQLiteException e) {
              getConfigLogger().verbose("Error adding data to table " + tableName + " Recreating DB");
              dbHelper.deleteDatabase();
          } finally {
              dbHelper.close();
          }
          return ret;
      }
docs: Adds a JSON string representing to the DB.
  
  @param obj the JSON to record
  @return the number of rows in the table, or DB_OUT_OF_MEMORY_ERROR/DB_UPDATE_ERROR