/// <summary>
 /// Initializes a new instance of the NameRegistrationContext class.
 /// </summary>
 /// <param name="nameRegistration">Specifies a name registration object.</param>
 public NameRegistrationContext(NameRegistration nameRegistration)
 {
     this.Name = nameRegistration.Name;
     this.RegistrationId = nameRegistration.Id;
     this.SecretKey = nameRegistration.SecretKey;
 }
        /// <summary>
        /// Helper method to disasociate a registeration id to a name with the service.
        /// </summary>
        /// <param name="clientId">The adm client Id.</param>
        /// <param name="clientSecret">The adm client secret.</param>
        /// <param name="registration">Specifies a name registration object.</param>
        /// <param name="onComplete">Specifies an "on complete" delegate callback.</param>
        /// <param name="stateObject">Specifies a user defined object.</param>
        public static void DisassociateIdAsync(
            string clientId,
            string clientSecret,
            NameRegistration registration,
            ServiceAgent<NameRegistrationResult>.OnCompleteDelegate onComplete,
            object stateObject = null)
        {
            if (string.IsNullOrEmpty(clientId))
            {
                throw new ArgumentNullException("clientId");
            }

            if (string.IsNullOrEmpty(clientSecret))
            {
                throw new ArgumentNullException("clientSecret");
            }

            DisassociateIdAsync(
                new AdmAuthClientIdentity(clientId, clientSecret, RendezvousService.ServiceScope),
                registration,
                onComplete,
                stateObject);
        }
        /// <summary>
        /// Helper method to disasociate a registeration id to a name with the service.
        /// </summary>
        /// <param name="identity">The hawaii client identity.</param>
        /// <param name="registration">Specifies a name registration object.</param>
        /// <param name="onComplete">Specifies an "on complete" delegate callback.</param>
        /// <param name="stateObject">Specifies a user defined object.</param>
        private static void DisassociateIdAsync(
            ClientIdentity identity,
            NameRegistration registration,
            ServiceAgent<NameRegistrationResult>.OnCompleteDelegate onComplete,
            object stateObject = null)
        {
            DisassociateIdAgent agent = new DisassociateIdAgent(
                RendezvousService.HostName,
                identity,
                registration,
                stateObject);

            agent.ProcessRequest(onComplete);
        }
        /// <summary>
        /// Helper method to disasociate a registeration id to a name with the service.
        /// </summary>
        /// <param name="hawaiiAppId">Specifies the Hawaii Application Id.</param>
        /// <param name="registration">Specifies a name registration object.</param>
        /// <param name="onComplete">Specifies an "on complete" delegate callback.</param>
        /// <param name="stateObject">Specifies a user defined object.</param>
        public static void DisassociateIdAsync(
            string hawaiiAppId, 
            NameRegistration registration,
            ServiceAgent<NameRegistrationResult>.OnCompleteDelegate onComplete, 
            object stateObject = null)
        {
            if (string.IsNullOrEmpty(hawaiiAppId))
            {
                throw new ArgumentNullException("hawaiiAppId");
            }

            DisassociateIdAsync(
                new GuidAuthClientIdentity(hawaiiAppId), 
                registration, 
                onComplete,
                stateObject);
        }