store messages in db