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

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

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