internal static SerializeableAttachment GetSerializeableAttachment(Attachment att)
        {
            if (att == null)
            {
                return(null);
            }

            var saa = new SerializeableAttachment();

            saa._contentId          = att.ContentId;
            saa._contentDisposition =
                SerializeableContentDisposition.GetSerializeableContentDisposition(att.ContentDisposition);

            if (att.ContentStream != null)
            {
                var bytes = new byte[att.ContentStream.Length];
                att.ContentStream.Read(bytes, 0, bytes.Length);

                saa._contentStream = new MemoryStream(bytes);
            }

            saa._contentType      = SerializeableContentType.GetSerializeableContentType(att.ContentType);
            saa._name             = att.Name;
            saa._transferEncoding = att.TransferEncoding;
            saa._nameEncoding     = att.NameEncoding;
            return(saa);
        }
        internal static SerializeableContentDisposition GetSerializeableContentDisposition(ContentDisposition cd)
        {
            if (cd == null)
            {
                return(null);
            }

            var scd = new SerializeableContentDisposition();

            scd.CreationDate     = cd.CreationDate;
            scd.DispositionType  = cd.DispositionType;
            scd.FileName         = cd.FileName;
            scd.Inline           = cd.Inline;
            scd.ModificationDate = cd.ModificationDate;
            scd.Parameters       = SerializeableCollection.GetSerializeableCollection(cd.Parameters);
            scd.ReadDate         = cd.ReadDate;
            scd.Size             = cd.Size;

            return(scd);
        }