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

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

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