protected void SubmitButton_Click(object sender, EventArgs e)
        {
            if (!Page.IsValid)
            {
                return;
            }

            MissingFieldsMessage.Visible = false;

            var contact = XrmContext.MergeClone(Contact);

            ManageLists(XrmContext, contact);

            ProfileFormView.UpdateItem();

            var returnUrl = Request["returnurl"];

            if (!string.IsNullOrWhiteSpace(returnUrl))
            {
                Context.RedirectAndEndResponse(returnUrl);
            }
        }
        protected void SubmitButton_Click(object sender, EventArgs e)
        {
            if (!Page.IsValid)
            {
                return;
            }

            MissingFieldsMessage.Visible = false;

            var contact = XrmContext.MergeClone(Contact);

            ManageLists(XrmContext, contact);

            ProfileFormView.UpdateItem();

            var returnUrl = Request["returnurl"];

            var languageContext = this.Context.GetContextLanguageInfo();

            if (languageContext.IsCrmMultiLanguageEnabled && _forceRedirect)
            {
                // When forcing redirect for language change, make the confirmation message visible after redirect
                // It is only needed when redirecting back to Profile page
                if (string.IsNullOrWhiteSpace(returnUrl))
                {
                    Session[ConfirmationOneTimeMessageSessionKey] = true;
                }

                // respect returnUrl if it was provided during the form submit
                // otherwise, redirect back to current page
                var redirectUri = string.IsNullOrWhiteSpace(returnUrl) ? Request.Url : returnUrl.AsAbsoluteUri(Request.Url);
                returnUrl = languageContext.FormatUrlWithLanguage(overrideUri: redirectUri);
            }

            if (!string.IsNullOrWhiteSpace(returnUrl))
            {
                Context.RedirectAndEndResponse(returnUrl);
            }
        }