Moved code from Server to ChatManager and Chat.