/// <summary>
        /// Serializable Mail Message Contstructor
        /// </summary>
        /// <param name="mailMessage">Original Mail Message to be serialized</param>
        public SerializableMailMessage(MailMessage mailMessage)
        {
            MailID              = Guid.NewGuid().ToString();
            this.IsBodyHtml     = mailMessage.IsBodyHtml;
            this.Body           = mailMessage.Body;
            this.Subject        = mailMessage.Subject;
            this.SerializedFrom = SerializableMailAddress.GetSerializableMailAddress(mailMessage.From);

            this.serializedTo = new List <SerializableMailAddress>();
            foreach (var ma in mailMessage.To)
            {
                this.serializedTo.Add(SerializableMailAddress.GetSerializableMailAddress(ma));
            }

            this.serializedBcc = new List <SerializableMailAddress>();
            foreach (var ma in mailMessage.Bcc)
            {
                this.serializedBcc.Add(SerializableMailAddress.GetSerializableMailAddress(ma));
            }

            this.serializedCC = new List <SerializableMailAddress>();
            foreach (var ma in mailMessage.CC)
            {
                this.serializedCC.Add(SerializableMailAddress.GetSerializableMailAddress(ma));
            }

            this.serializedReplyTo = new List <SerializableMailAddress>();
            foreach (var ma in mailMessage.ReplyToList)
            {
                this.serializedReplyTo.Add(SerializableMailAddress.GetSerializableMailAddress(ma));
            }

            this.serializedAttachments = new List <SerializableAttachment>();
            foreach (var att in mailMessage.Attachments)
            {
                this.serializedAttachments.Add(SerializableAttachment.GetSerializeableAttachment(att));
            }

            this.bodyEncoding = mailMessage.BodyEncoding;

            this.serializedDeliveryNotificationOptions = mailMessage.DeliveryNotificationOptions;
            this.serializedHeaders = SerializableCollection.GetSerializableCollection(mailMessage.Headers);
            this.mailPriority      = mailMessage.Priority;
            this.SerializedSender  = SerializableMailAddress.GetSerializableMailAddress(mailMessage.Sender);
            this.subjectEncoding   = mailMessage.SubjectEncoding;

            foreach (var av in mailMessage.AlternateViews)
            {
                this.serializedAlternateViews.Add(SerializableAlternateView.GetSerializableAlternateView(av));
            }
        }
        /// <summary>
        /// Serializes mail address
        /// </summary>
        /// <param name="mailAddress">original mail address that needs to be serailized</param>
        /// <returns></returns>
        public static SerializableMailAddress GetSerializableMailAddress(MailAddress mailAddress)
        {
            if (mailAddress == null)
            {
                return(null);
            }
            var serializedMailAddress = new SerializableMailAddress
            {
                displayName = mailAddress.DisplayName,
                address     = mailAddress.Address
            };

            return(serializedMailAddress);
        }