/// <summary>
        /// Grants office access to a form group
        /// </summary>
        /// <param name="basePath">BasePath for API calls (URI)</param>
        /// <param name="accessToken">Access Token for API call (OAuth)</param>
        /// <param name="accountId">The DocuSign Account ID (GUID or short version) for which the APIs call would be made</param>
        /// <param name="formGroupId">The Id of the specified form group</param>
        /// <param name="formToAssign">The form to be assigned to form group</param>
        /// <returns>The form to be assigned to form group</returns>
        public static FormGroupFormToAssign AssignForm(
            string basePath,
            string accessToken,
            string accountId,
            string formGroupId,
            FormGroupFormToAssign formToAssign)
        {
            // Construct your API headers
            var apiClient = new ApiClient(basePath);

            apiClient.Configuration.DefaultHeader.Add("Authorization", "Bearer " + accessToken);
            var formGroupsApi = new FormGroupsApi(apiClient);

            // Call the Rooms API to assign form to form group
            return(formGroupsApi.AssignFormGroupForm(accountId, new Guid(formGroupId), formToAssign));
        }
        public ActionResult AssignFormToFormGroup(FormFormGroupModel formFormGroupModel)
        {
            string accessToken = RequestItemsService.User.AccessToken;
            var    basePath    = $"{RequestItemsService.Session.RoomsApiBasePath}/restapi"; // Base API path

            var apiClient = new ApiClient(basePath);

            apiClient.Configuration.DefaultHeader.Add("Authorization", "Bearer " + accessToken);

            var formGroupsApi = new FormGroupsApi(apiClient);

            string accountId = RequestItemsService.Session.AccountId;

            try
            {
                // Step 6 start
                FormGroupFormToAssign formGroupFormToAssign = formGroupsApi.AssignFormGroupForm(accountId, new Guid(formFormGroupModel.FormGroupId), new FormGroupFormToAssign()
                {
                    FormId = formFormGroupModel.FormId
                });
                // Step 6 end

                ViewBag.h1          = "The form was assigned to the form group successfully";
                ViewBag.message     = $"The form ('{formGroupFormToAssign.FormId}') was assigned to the form group ('{formFormGroupModel.FormGroupId}') successfully";
                ViewBag.Locals.Json = JsonConvert.SerializeObject(formGroupFormToAssign, Formatting.Indented);

                return(View("example_done"));
            }
            catch (ApiException apiException)
            {
                ViewBag.errorCode    = apiException.ErrorCode;
                ViewBag.errorMessage = apiException.Message;

                return(View("Error"));
            }
        }