/// <summary>
        /// Update an existing subscription.
        /// </summary>
        /// <param name="subscription">The subscription</param>
        /// <exception cref="ArgumentNullException">
        /// The <paramref name="subscription"/> parameter is <b>null</b>.
        /// </exception>        
        ///         
        /// <exception cref="InvalidOperationException">
        /// The <see cref="CommonSubscriptionData.Id"/> property is <b>null</b>.
        /// </exception>        
        /// 
        /// <exception cref="HealthServiceException">
        /// The HealthVault service returned an error.
        /// </exception>
        public void UpdateSubscription(Subscription subscription)
        {
            Validator.ThrowIfArgumentNull(subscription, "subscription", "SubscriptionNull");
            Validator.ThrowArgumentExceptionIf(subscription.CommonSubscriptionData == null, "subscription", "SubscriptionCommonSubscriptionDataNull");
            Validator.ThrowInvalidIfNull(subscription.CommonSubscriptionData.Id, "SubscriptionIdNull");

            HealthServiceRequest request = CreateRequest("UpdateEventSubscription", 1);

            StringBuilder requestParameters = new StringBuilder();

            using (XmlWriter writer = CreateWriter(requestParameters))
            {
                subscription.Serialize(writer);

                writer.Flush();
            }

            request.Parameters = requestParameters.ToString();

            request.Execute();
        }
        /// <summary>
        /// Register a subscription with the HealthVault platform.
        /// </summary>
        /// <remarks>
        /// After the subscription is registered the <see cref="CommonSubscriptionData.Id"/>
        /// property will be set to the unique identifier of the subscription.
        /// Applications may want to save this identifier to modify the subscription later. 
        /// </remarks>
        /// <param name="subscription">The subscription to register.</param>
        /// 
        /// <exception cref="ArgumentNullException">
        /// The <paramref name="subscription"/> parameter is <b>null</b>.
        /// </exception>        
        ///         
        /// <exception cref="InvalidOperationException">
        /// The <see cref="CommonSubscriptionData.Id"/> property is not <b>null</b>.
        /// </exception>        
        /// 
        /// <exception cref="HealthServiceException">
        /// The HealthVault service returned an error.
        /// </exception>
        public void Subscribe(Subscription subscription)
        {
            Validator.ThrowIfArgumentNull(subscription, "subscription", "SubscriptionNull");
            Validator.ThrowArgumentExceptionIf(subscription.CommonSubscriptionData == null, "subscription", "SubscriptionCommonSubscriptionDataNull");

            HealthServiceRequest request = CreateRequest("SubscribeToEvent", 1);

            Validator.ThrowInvalidIf(subscription.CommonSubscriptionData.Id != null, "SubscriptionAlreadyCreated");

            StringBuilder requestParameters = new StringBuilder();

            using (XmlWriter writer = CreateWriter(requestParameters))
            {
                subscription.Serialize(writer);

                writer.Flush();
            }

            request.Parameters = requestParameters.ToString();

            request.Execute();

            XPathNavigator infoNav =
                request.Response.InfoNavigator.SelectSingleNode(
                    SDKHelper.GetInfoXPathExpressionForMethod(
                        request.Response.InfoNavigator,
                        "SubscribeToEvent"));

            XPathNavigator subscriptionIdNavigator =
                infoNav.SelectSingleNode("subscription-id");

            subscription.CommonSubscriptionData.Id = new Guid(subscriptionIdNavigator.Value);
        }