/// <summary>
        /// Сохранить тело сообщения.
        /// </summary>
        /// <param name="body"></param>
        public virtual void SaveMessageBody(MessageBody body)
        {
            #region Validate parameters
            if (body == null)
            {
                throw new ArgumentNullException("body");
            }
            #endregion

            MessageBodyInfo bodyInfo    = body.BodyInfo();
            ContentType     contentType = bodyInfo.ContentType();
            Encoding        encoding    = contentType.Encoding();

            DAO.MessageBodyInfo dao = bodyInfo.ToDao();

            using (UnitOfWork work = BeginWork())
            {
                work.Update <DAO.MessageBodyInfo>(ref dao);

                using (MessageBodyStreamBase stream = ConstructMessageBodyStream(dao.MessageLINK, work, DataStreamMode.WRITE, encoding))
                {
                    stream.WriteTimeout = this.ExecuteTimeout;

                    var buffer = new char[this.bufferSize];
                    int charsReaded;
                    do
                    {
                        charsReaded = body.Value.Read(buffer, 0, buffer.Length);
                        if (charsReaded > 0)
                        {
                            stream.Write(buffer, 0, charsReaded);
                        }
                    } while (charsReaded > 0);

                    if (dao.Length == null)
                    {
                        dao.Length = (int)stream.Length;
                        work.Update <DAO.MessageBodyInfo>(ref dao);
                    }

                    work.End();
                }
            }

            bodyInfo = dao.ToObj();
            body.ApplyInfo(bodyInfo);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="dao"></param>
        /// <returns></returns>
        public static MessageBodyInfo ToObj(this DAO.MessageBodyInfo dao)
        {
            if (dao == null)
            {
                return(null);
            }

            var obj = new MessageBodyInfo();

            obj.FileSize    = dao.FileSize;
            obj.Length      = dao.Length;
            obj.MessageLINK = dao.MessageLINK;
            obj.Name        = dao.Name;
            obj.Type        = dao.Type;

            return(obj);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public static DAO.MessageBodyInfo ToDao(this MessageBodyInfo obj)
        {
            if (obj == null)
            {
                return(null);
            }

            var dao = new DAO.MessageBodyInfo();

            dao.FileSize    = obj.FileSize;
            dao.Length      = obj.Length;
            dao.MessageLINK = obj.MessageLINK;
            dao.Name        = obj.Name;
            dao.Type        = obj.Type;

            return(dao);
        }