Code to add message to the database after it is received