protected ParagoServiceApplication GetServiceApplication()
        {
            try
            {
                return(AdminUIHelper.GetServiceApplication(ServiceApplicationID));
            }
            catch (Exception)
            {
                RedirectToErrorPage("Could not connect to Parago Service Application. Please check the event logs for more information.");
            }

            return(null);
        }
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (!Page.IsPostBack)
            {
                if (ServiceApplicationID == Guid.Empty)
                {
                    DialogMaster.OkButton.Text = "Create";
                }
                else
                {
                    ParagoServiceApplication serviceApplication = GetServiceApplication();

                    if (!AdminUIHelper.HasUserReadPermissionForCurrentPage(serviceApplication))
                    {
                        SPUtility.HandleAccessDenied(new UnauthorizedAccessException("You are not authorized to access this page."));
                    }

                    PopulateSettings(serviceApplication);
                }
            }
        }