code: synchronized void upsertMessages(ArrayList<CTMessageDAO> inboxMessages){
          if (!this.belowMemThreshold()) {
              Logger.v("There is not enough space left on the device to store data, data discarded");
              return;
          }
          //noinspection TryFinallyCanBeTryWithResources
          try {
              final SQLiteDatabase db = dbHelper.getWritableDatabase();
              for(CTMessageDAO messageDAO : inboxMessages) {
                  final ContentValues cv = new ContentValues();
                  cv.put(_ID, messageDAO.getId());
                  cv.put(KEY_DATA, messageDAO.getJsonData().toString());
                  cv.put(WZRKPARAMS, messageDAO.getWzrkParams().toString());
                  cv.put(CAMPAIGN,messageDAO.getCampaignId());
                  cv.put(TAGS, messageDAO.getTags());
                  cv.put(IS_READ, messageDAO.isRead());
                  cv.put(EXPIRES, messageDAO.getExpires());
                  cv.put(KEY_CREATED_AT,messageDAO.getDate());
                  cv.put(USER_ID,messageDAO.getUserId());
                  db.insertWithOnConflict(Table.INBOX_MESSAGES.getName(),null,cv,SQLiteDatabase.CONFLICT_REPLACE);
              }
          } catch (final SQLiteException e) {
              getConfigLogger().verbose("Error adding data to table " + Table.INBOX_MESSAGES.getName());
          } finally {
              dbHelper.close();
          }
      }
docs: Stores a list of inbox messages
  @param inboxMessages ArrayList of type {@link CTMessageDAO}