/// <summary>
        /// 转换为MessageSession用于数据库存储
        /// </summary>
        public MessageSession AsMessageSession()
        {
            MessageSession messageSession;

            if (SessionId > 0)
            {
                MessageService messageService = new MessageService();
                messageSession = messageService.GetSession(SessionId);
                messageSession.LastMessageId      = this.LastMessageId;
                messageSession.MessageCount       = this.MessageCount;
                messageSession.MessageType        = this.MessageType;
                messageSession.OtherUserId        = this.OtherUserId;
                messageSession.UnreadMessageCount = this.UnreadMessageCount;
                messageSession.UserId             = this.UserId;
            }
            else
            {
                messageSession = MessageSession.New();
                messageSession.LastMessageId      = this.LastMessageId;
                messageSession.MessageCount       = this.MessageCount;
                messageSession.MessageType        = this.MessageType;
                messageSession.OtherUserId        = this.OtherUserId;
                messageSession.UnreadMessageCount = this.UnreadMessageCount;
                messageSession.UserId             = this.UserId;
            }
            return(messageSession);
        }