/// <summary>
        /// Updates the specified ProgramControlType using PATCH.
        /// </summary>
        /// <param name="programControlTypeToUpdate">The ProgramControlType 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 ProgramControlType.</returns>
        public async System.Threading.Tasks.Task <ProgramControlType> UpdateAsync(ProgramControlType programControlTypeToUpdate, CancellationToken cancellationToken)
        {
            if (programControlTypeToUpdate.AdditionalData != null)
            {
                if (programControlTypeToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    programControlTypeToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, programControlTypeToUpdate.GetType().Name)
                    });
                }
            }
            if (programControlTypeToUpdate.AdditionalData != null)
            {
                if (programControlTypeToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    programControlTypeToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, programControlTypeToUpdate.GetType().Name)
                    });
                }
            }
            this.ContentType = "application/json";
            this.Method      = "PATCH";
            var updatedEntity = await this.SendAsync <ProgramControlType>(programControlTypeToUpdate, cancellationToken).ConfigureAwait(false);

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

            this.InitializeCollectionProperties(newEntity);
            return(newEntity);
        }
 /// <summary>
 /// Adds the specified ProgramControlType to the collection via POST.
 /// </summary>
 /// <param name="programControlType">The ProgramControlType to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created ProgramControlType.</returns>
 public System.Threading.Tasks.Task <ProgramControlType> AddAsync(ProgramControlType programControlType, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <ProgramControlType>(programControlType, cancellationToken));
 }
 /// <summary>
 /// Adds the specified ProgramControlType to the collection via POST.
 /// </summary>
 /// <param name="programControlType">The ProgramControlType to add.</param>
 /// <returns>The created ProgramControlType.</returns>
 public System.Threading.Tasks.Task <ProgramControlType> AddAsync(ProgramControlType programControlType)
 {
     return(this.AddAsync(programControlType, CancellationToken.None));
 }
 /// <summary>
 /// Initializes any collection properties after deserialization, like next requests for paging.
 /// </summary>
 /// <param name="programControlTypeToInitialize">The <see cref="ProgramControlType"/> with the collection properties to initialize.</param>
 private void InitializeCollectionProperties(ProgramControlType programControlTypeToInitialize)
 {
 }
 /// <summary>
 /// Updates the specified ProgramControlType using PATCH.
 /// </summary>
 /// <param name="programControlTypeToUpdate">The ProgramControlType to update.</param>
 /// <returns>The updated ProgramControlType.</returns>
 public System.Threading.Tasks.Task <ProgramControlType> UpdateAsync(ProgramControlType programControlTypeToUpdate)
 {
     return(this.UpdateAsync(programControlTypeToUpdate, CancellationToken.None));
 }