/// <summary>
        /// Initializes any collection properties after deserialization, like next requests for paging.
        /// </summary>
        /// <param name="androidWorkProfileScepCertificateProfileToInitialize">The <see cref="AndroidWorkProfileScepCertificateProfile"/> with the collection properties to initialize.</param>
        private void InitializeCollectionProperties(AndroidWorkProfileScepCertificateProfile androidWorkProfileScepCertificateProfileToInitialize)
        {
            if (androidWorkProfileScepCertificateProfileToInitialize != null && androidWorkProfileScepCertificateProfileToInitialize.AdditionalData != null)
            {
                if (androidWorkProfileScepCertificateProfileToInitialize.ManagedDeviceCertificateStates != null && androidWorkProfileScepCertificateProfileToInitialize.ManagedDeviceCertificateStates.CurrentPage != null)
                {
                    androidWorkProfileScepCertificateProfileToInitialize.ManagedDeviceCertificateStates.AdditionalData = androidWorkProfileScepCertificateProfileToInitialize.AdditionalData;

                    object nextPageLink;
                    androidWorkProfileScepCertificateProfileToInitialize.AdditionalData.TryGetValue("*****@*****.**", out nextPageLink);
                    var nextPageLinkString = nextPageLink as string;

                    if (!string.IsNullOrEmpty(nextPageLinkString))
                    {
                        androidWorkProfileScepCertificateProfileToInitialize.ManagedDeviceCertificateStates.InitializeNextPageRequest(
                            this.Client,
                            nextPageLinkString);
                    }
                }
            }
        }
        /// <summary>
        /// Creates the specified AndroidWorkProfileScepCertificateProfile using POST.
        /// </summary>
        /// <param name="androidWorkProfileScepCertificateProfileToCreate">The AndroidWorkProfileScepCertificateProfile to create.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The created AndroidWorkProfileScepCertificateProfile.</returns>
        public async System.Threading.Tasks.Task <AndroidWorkProfileScepCertificateProfile> CreateAsync(AndroidWorkProfileScepCertificateProfile androidWorkProfileScepCertificateProfileToCreate, CancellationToken cancellationToken)
        {
            this.ContentType = "application/json";
            this.Method      = "POST";
            var newEntity = await this.SendAsync <AndroidWorkProfileScepCertificateProfile>(androidWorkProfileScepCertificateProfileToCreate, cancellationToken).ConfigureAwait(false);

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

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