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

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

            this.InitializeCollectionProperties(newEntity);
            return(newEntity);
        }
 /// <summary>
 /// Creates the specified SchedulingGroup using POST.
 /// </summary>
 /// <param name="schedulingGroupToCreate">The SchedulingGroup to create.</param>
 /// <returns>The created SchedulingGroup.</returns>
 public System.Threading.Tasks.Task <SchedulingGroup> CreateAsync(SchedulingGroup schedulingGroupToCreate)
 {
     return(this.CreateAsync(schedulingGroupToCreate, CancellationToken.None));
 }
 /// <summary>
 /// Initializes any collection properties after deserialization, like next requests for paging.
 /// </summary>
 /// <param name="schedulingGroupToInitialize">The <see cref="SchedulingGroup"/> with the collection properties to initialize.</param>
 private void InitializeCollectionProperties(SchedulingGroup schedulingGroupToInitialize)
 {
 }
 /// <summary>
 /// Adds the specified SchedulingGroup to the collection via POST.
 /// </summary>
 /// <param name="schedulingGroup">The SchedulingGroup to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created SchedulingGroup.</returns>
 public System.Threading.Tasks.Task <SchedulingGroup> AddAsync(SchedulingGroup schedulingGroup, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <SchedulingGroup>(schedulingGroup, cancellationToken));
 }
 /// <summary>
 /// Adds the specified SchedulingGroup to the collection via POST.
 /// </summary>
 /// <param name="schedulingGroup">The SchedulingGroup to add.</param>
 /// <returns>The created SchedulingGroup.</returns>
 public System.Threading.Tasks.Task <SchedulingGroup> AddAsync(SchedulingGroup schedulingGroup)
 {
     return(this.AddAsync(schedulingGroup, CancellationToken.None));
 }