ChatMessageRepository with tests