/// <summary>
        /// Gets the XML payload for sending to push-channel.
        /// </summary>
        /// <param name="push"></param>
        /// <returns></returns>
        private string GetPayload(WindowsPhoneToast push)
        {
            XNamespace wp           = "WPNotification";
            var        notification = new XElement(wp + "Notification", new XAttribute(XNamespace.Xmlns + "wp", "WPNotification"));

            var toast = new XElement(wp + "Toast");

            if (!string.IsNullOrEmpty(push.Text1))
            {
                toast.Add(new XElement(wp + "Text1", push.Text1));
            }

            if (!string.IsNullOrEmpty(push.Text2))
            {
                toast.Add(new XElement(wp + "Text2", push.Text2));
            }

            if (!string.IsNullOrEmpty(push.NavigatePath) || (push.Parameters != null && push.Parameters.Count > 0))
            {
                var sb = new StringBuilder();

                if (!string.IsNullOrEmpty(push.NavigatePath))
                {
                    sb.Append("/" + push.NavigatePath.TrimStart('/'));
                }

                if (push.Parameters != null && push.Parameters.Count > 0)
                {
                    sb.Append("?");

                    foreach (string key in push.Parameters.Keys)
                    {
                        sb.Append(key + "=" + push.Parameters[key] + "&");
                    }
                }

                var paramValue = sb.ToString();

                if (!string.IsNullOrEmpty(paramValue) && paramValue.EndsWith("&"))
                {
                    paramValue = paramValue.Substring(0, paramValue.Length - 1);
                }

                if (!string.IsNullOrEmpty(paramValue))
                {
                    toast.Add(new XElement(wp + "Param", paramValue));
                }
            }

            notification.Add(toast);
            return(notification.ToString());
        }
        /// <summary>
        /// Gets the XML payload for sending to push-channel.
        /// </summary>
        /// <param name="push"></param>
        /// <returns></returns>
        private string GetPayload(WindowsPhoneToast push)
        {
            XNamespace wp = "WPNotification";
            var notification = new XElement(wp + "Notification", new XAttribute(XNamespace.Xmlns + "wp", "WPNotification"));

            var toast = new XElement(wp + "Toast");

            if (!string.IsNullOrEmpty(push.Text1))
                toast.Add(new XElement(wp + "Text1", push.Text1));

            if (!string.IsNullOrEmpty(push.Text2))
                toast.Add(new XElement(wp + "Text2", push.Text2));

            if (!string.IsNullOrEmpty(push.NavigatePath) || (push.Parameters != null && push.Parameters.Count > 0))
            {
                var sb = new StringBuilder();

                if (!string.IsNullOrEmpty(push.NavigatePath))
                    sb.Append("/" + push.NavigatePath.TrimStart('/'));

                if (push.Parameters != null && push.Parameters.Count > 0)
                {
                    sb.Append("?");

                    foreach (string key in push.Parameters.Keys)
                        sb.Append(key + "=" + push.Parameters[key] + "&");
                }

                var paramValue = sb.ToString();

                if (!string.IsNullOrEmpty(paramValue) && paramValue.EndsWith("&"))
                    paramValue = paramValue.Substring(0, paramValue.Length - 1);

                if (!string.IsNullOrEmpty(paramValue))
                    toast.Add(new XElement(wp + "Param", paramValue));
            }

            notification.Add(toast);
            return notification.ToString();
        }