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

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

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

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

                    if (!string.IsNullOrEmpty(nextPageLinkString))
                    {
                        roomListToInitialize.Rooms.InitializeNextPageRequest(
                            this.Client,
                            nextPageLinkString);
                    }
                }
            }
        }
 /// <summary>
 /// Creates the specified RoomList using POST.
 /// </summary>
 /// <param name="roomListToCreate">The RoomList to create.</param>
 /// <returns>The created RoomList.</returns>
 public System.Threading.Tasks.Task <RoomList> CreateAsync(RoomList roomListToCreate)
 {
     return(this.CreateAsync(roomListToCreate, CancellationToken.None));
 }