/// <summary>
        /// Initializes any collection properties after deserialization, like next requests for paging.
        /// </summary>
        /// <param name="microsoftAuthenticatorAuthenticationMethodConfigurationToInitialize">The <see cref="MicrosoftAuthenticatorAuthenticationMethodConfiguration"/> with the collection properties to initialize.</param>
        private void InitializeCollectionProperties(MicrosoftAuthenticatorAuthenticationMethodConfiguration microsoftAuthenticatorAuthenticationMethodConfigurationToInitialize)
        {
            if (microsoftAuthenticatorAuthenticationMethodConfigurationToInitialize != null && microsoftAuthenticatorAuthenticationMethodConfigurationToInitialize.AdditionalData != null)
            {
                if (microsoftAuthenticatorAuthenticationMethodConfigurationToInitialize.IncludeTargets != null && microsoftAuthenticatorAuthenticationMethodConfigurationToInitialize.IncludeTargets.CurrentPage != null)
                {
                    microsoftAuthenticatorAuthenticationMethodConfigurationToInitialize.IncludeTargets.AdditionalData = microsoftAuthenticatorAuthenticationMethodConfigurationToInitialize.AdditionalData;

                    object nextPageLink;
                    microsoftAuthenticatorAuthenticationMethodConfigurationToInitialize.AdditionalData.TryGetValue("*****@*****.**", out nextPageLink);
                    var nextPageLinkString = nextPageLink as string;

                    if (!string.IsNullOrEmpty(nextPageLinkString))
                    {
                        microsoftAuthenticatorAuthenticationMethodConfigurationToInitialize.IncludeTargets.InitializeNextPageRequest(
                            this.Client,
                            nextPageLinkString);
                    }
                }
            }
        }
        /// <summary>
        /// Creates the specified MicrosoftAuthenticatorAuthenticationMethodConfiguration using POST.
        /// </summary>
        /// <param name="microsoftAuthenticatorAuthenticationMethodConfigurationToCreate">The MicrosoftAuthenticatorAuthenticationMethodConfiguration to create.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The created MicrosoftAuthenticatorAuthenticationMethodConfiguration.</returns>
        public async System.Threading.Tasks.Task <MicrosoftAuthenticatorAuthenticationMethodConfiguration> CreateAsync(MicrosoftAuthenticatorAuthenticationMethodConfiguration microsoftAuthenticatorAuthenticationMethodConfigurationToCreate, CancellationToken cancellationToken)
        {
            this.ContentType = "application/json";
            this.Method      = "POST";
            var newEntity = await this.SendAsync <MicrosoftAuthenticatorAuthenticationMethodConfiguration>(microsoftAuthenticatorAuthenticationMethodConfigurationToCreate, cancellationToken).ConfigureAwait(false);

            this.InitializeCollectionProperties(newEntity);
            return(newEntity);
        }
 /// <summary>
 /// Creates the specified MicrosoftAuthenticatorAuthenticationMethodConfiguration using POST.
 /// </summary>
 /// <param name="microsoftAuthenticatorAuthenticationMethodConfigurationToCreate">The MicrosoftAuthenticatorAuthenticationMethodConfiguration to create.</param>
 /// <returns>The created MicrosoftAuthenticatorAuthenticationMethodConfiguration.</returns>
 public System.Threading.Tasks.Task <MicrosoftAuthenticatorAuthenticationMethodConfiguration> CreateAsync(MicrosoftAuthenticatorAuthenticationMethodConfiguration microsoftAuthenticatorAuthenticationMethodConfigurationToCreate)
 {
     return(this.CreateAsync(microsoftAuthenticatorAuthenticationMethodConfigurationToCreate, CancellationToken.None));
 }
        /// <summary>
        /// Updates the specified MicrosoftAuthenticatorAuthenticationMethodConfiguration using PATCH.
        /// </summary>
        /// <param name="microsoftAuthenticatorAuthenticationMethodConfigurationToUpdate">The MicrosoftAuthenticatorAuthenticationMethodConfiguration to update.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <exception cref="ClientException">Thrown when an object returned in a response is used for updating an object in Microsoft Graph.</exception>
        /// <returns>The updated MicrosoftAuthenticatorAuthenticationMethodConfiguration.</returns>
        public async System.Threading.Tasks.Task <MicrosoftAuthenticatorAuthenticationMethodConfiguration> UpdateAsync(MicrosoftAuthenticatorAuthenticationMethodConfiguration microsoftAuthenticatorAuthenticationMethodConfigurationToUpdate, CancellationToken cancellationToken)
        {
            if (microsoftAuthenticatorAuthenticationMethodConfigurationToUpdate.AdditionalData != null)
            {
                if (microsoftAuthenticatorAuthenticationMethodConfigurationToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    microsoftAuthenticatorAuthenticationMethodConfigurationToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, microsoftAuthenticatorAuthenticationMethodConfigurationToUpdate.GetType().Name)
                    });
                }
            }
            if (microsoftAuthenticatorAuthenticationMethodConfigurationToUpdate.AdditionalData != null)
            {
                if (microsoftAuthenticatorAuthenticationMethodConfigurationToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    microsoftAuthenticatorAuthenticationMethodConfigurationToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, microsoftAuthenticatorAuthenticationMethodConfigurationToUpdate.GetType().Name)
                    });
                }
            }
            this.ContentType = "application/json";
            this.Method      = "PATCH";
            var updatedEntity = await this.SendAsync <MicrosoftAuthenticatorAuthenticationMethodConfiguration>(microsoftAuthenticatorAuthenticationMethodConfigurationToUpdate, cancellationToken).ConfigureAwait(false);

            this.InitializeCollectionProperties(updatedEntity);
            return(updatedEntity);
        }