/// <summary>
        /// Update user asynchronously.
        /// </summary>
        /// <example>
        /// This example shows how to use the <see cref="AccountManagementApi.UpdateUserAsync(string, User)"/> method.
        /// <code>
        /// try
        /// {
        ///     var updatedInfo = new User
        ///     {
        ///         FullName = "Sir Monty Bot",
        ///         Username = "******",
        ///     }
        ///     var updatedUser = await accountApi.UpdateUserAsync("015c3c46514802420a010b1000000000", updatedInfo);
        ///     return updatedUser;
        /// }
        /// catch (Exception)
        /// {
        ///     throw;
        /// }
        /// </code>
        /// </example>
        /// <param name="userId">Id</param>
        /// <param name="user"><see cref="User"/></param>
        /// <returns><see cref="User"/></returns>
        /// <exception cref="CloudApiException">CloudApiException</exception>
        public async Task <User> UpdateUserAsync(string userId, User user)
        {
            try
            {
                var req      = user.CreatePutRequest();
                var userData = await AdminApi.UpdateUserAsync(userId, req);

                return(User.Map(userData));
            }
            catch (iam.Client.ApiException e)
            {
                throw new CloudApiException(e.ErrorCode, e.Message, e.ErrorContent);
            }
        }