/// <summary>
        /// Creates the specified ManagedAppConfiguration using POST.
        /// </summary>
        /// <param name="managedAppConfigurationToCreate">The ManagedAppConfiguration to create.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The created ManagedAppConfiguration.</returns>
        public async System.Threading.Tasks.Task <ManagedAppConfiguration> CreateAsync(ManagedAppConfiguration managedAppConfigurationToCreate, CancellationToken cancellationToken)
        {
            this.ContentType = "application/json";
            this.Method      = "POST";
            var newEntity = await this.SendAsync <ManagedAppConfiguration>(managedAppConfigurationToCreate, cancellationToken).ConfigureAwait(false);

            this.InitializeCollectionProperties(newEntity);
            return(newEntity);
        }
 /// <summary>
 /// Initializes any collection properties after deserialization, like next requests for paging.
 /// </summary>
 /// <param name="managedAppConfigurationToInitialize">The <see cref="ManagedAppConfiguration"/> with the collection properties to initialize.</param>
 private void InitializeCollectionProperties(ManagedAppConfiguration managedAppConfigurationToInitialize)
 {
 }
 /// <summary>
 /// Creates the specified ManagedAppConfiguration using POST.
 /// </summary>
 /// <param name="managedAppConfigurationToCreate">The ManagedAppConfiguration to create.</param>
 /// <returns>The created ManagedAppConfiguration.</returns>
 public System.Threading.Tasks.Task <ManagedAppConfiguration> CreateAsync(ManagedAppConfiguration managedAppConfigurationToCreate)
 {
     return(this.CreateAsync(managedAppConfigurationToCreate, CancellationToken.None));
 }
        /// <summary>
        /// Updates the specified ManagedAppConfiguration using PATCH.
        /// </summary>
        /// <param name="managedAppConfigurationToUpdate">The ManagedAppConfiguration 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 ManagedAppConfiguration.</returns>
        public async System.Threading.Tasks.Task <ManagedAppConfiguration> UpdateAsync(ManagedAppConfiguration managedAppConfigurationToUpdate, CancellationToken cancellationToken)
        {
            if (managedAppConfigurationToUpdate.AdditionalData != null)
            {
                if (managedAppConfigurationToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    managedAppConfigurationToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, managedAppConfigurationToUpdate.GetType().Name)
                    });
                }
            }
            if (managedAppConfigurationToUpdate.AdditionalData != null)
            {
                if (managedAppConfigurationToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    managedAppConfigurationToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, managedAppConfigurationToUpdate.GetType().Name)
                    });
                }
            }
            this.ContentType = "application/json";
            this.Method      = "PATCH";
            var updatedEntity = await this.SendAsync <ManagedAppConfiguration>(managedAppConfigurationToUpdate, cancellationToken).ConfigureAwait(false);

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