saving conversations and messages to database