code: @Override
  	public synchronized void addOrUpdateMessages(ApptentiveMessage... apptentiveMessages) {
  		fetchEntries();
  
  		for (ApptentiveMessage apptentiveMessage : apptentiveMessages) {
  			MessageEntry existing = findMessageEntry(apptentiveMessage);
  			if (existing != null) {
  				// Update
  				existing.id = apptentiveMessage.getId();
  				existing.state = apptentiveMessage.getState().name();
  				if (apptentiveMessage.isRead()) { // A message can't be unread after being read.
  					existing.isRead = true;
  				}
  				existing.json = apptentiveMessage.getJsonObject().toString();
  			} else {
  				// Insert
  				MessageEntry entry = new MessageEntry();
  				entry.id = apptentiveMessage.getId();
  				entry.clientCreatedAt = apptentiveMessage.getClientCreatedAt();
  				entry.nonce = apptentiveMessage.getNonce();
  				entry.state = apptentiveMessage.getState().name();
  				entry.isRead = apptentiveMessage.isRead();
  				entry.json = apptentiveMessage.getJsonObject().toString();
  				messageEntries.add(entry);
  			}
  		}
  
  		writeToFile();
  	}
docs: region MessageStore