Fetch messages from database