private void CreateNodes()
        {
            SPUser origUser = SPContext.Current.Web.CurrentUser;

            SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                using (SPSite es = new SPSite(_web.Url))
                {
                    using (SPWeb ew = es.OpenWeb())
                    {
                        if (!_isNewHeading)
                        {
                            int headingNodeId = int.Parse(ddlNavigationHeadings.SelectedValue);
                            string title      = !string.IsNullOrEmpty(txtTitle.Text) ? txtTitle.Text : txtUrl.Text;
                            string url        = txtUrl.Text;
                            appHelper.CreateChildNode(_appId, _nodeType, title, url, headingNodeId, !appHelper.IsUrlInternal(url), origUser);
                            API.Applications.CreateQuickLaunchXML(_appId, ew);
                            API.Applications.CreateTopNavXML(_appId, ew);
                        }
                        else
                        {
                            string title = !string.IsNullOrEmpty(txtTitle.Text) ? txtTitle.Text : txtUrl.Text;
                            string url   = txtUrl.Text;
                            appHelper.CreateParentNode(_appId, _nodeType, title, url, !appHelper.IsUrlInternal(url), origUser);
                            API.Applications.CreateQuickLaunchXML(_appId, ew);
                            API.Applications.CreateTopNavXML(_appId, ew);
                        }
                    }
                }
            });

            Redirect();
        }
        private void Execute()
        {
            switch (_action.ToLower())
            {
            case "createparentnode":
                try
                {
                    appHelper.CreateParentNode(_appId, _nodeType, _title, _url, !appHelper.IsUrlInternal(_url), SPContext.Current.Web.AllUsers.GetByID(_origUserId));

                    API.Applications.CreateQuickLaunchXML(_appId, SPContext.Current.Web);
                    API.Applications.CreateTopNavXML(_appId, SPContext.Current.Web);
                }
                catch (Exception e)
                {
                    _status = "error: " + e.Message;
                }
                break;

            case "createchildnode":
                try
                {
                    appHelper.CreateChildNode(_appId, _nodeType, _title, _url, _headingNodeId, !appHelper.IsUrlInternal(_url), SPContext.Current.Web.AllUsers.GetByID(_origUserId));
                    API.Applications.CreateQuickLaunchXML(_appId, SPContext.Current.Web);
                    API.Applications.CreateTopNavXML(_appId, SPContext.Current.Web);
                }
                catch (Exception e)
                {
                    _status = "error: " + e.Message;
                }
                break;

            case "deletenode":
                try
                {
                    appHelper.DeleteNode(_appId, _nodeId, _nodeType, SPContext.Current.Web.AllUsers.GetByID(_origUserId));
                    API.Applications.CreateQuickLaunchXML(_appId, SPContext.Current.Web);
                    API.Applications.CreateTopNavXML(_appId, SPContext.Current.Web);
                }
                catch (Exception e)
                {
                    _status = "error: " + e.Message;
                }

                break;

            case "editnode":
                try
                {
                    appHelper.EditNodeById(_parentNodeId, _nodeId, _title, _url, _appId, _nodeType, SPContext.Current.Web.AllUsers.GetByID(_origUserId));
                    API.Applications.CreateQuickLaunchXML(_appId, SPContext.Current.Web);
                    API.Applications.CreateTopNavXML(_appId, SPContext.Current.Web);
                }
                catch (Exception e)
                {
                    _status = "error: " + e.Message;
                }
                break;

            case "movenode":
                try{
                    appHelper.UpdateNodeOrder(_appId, _nodeType, _moveInfos, SPContext.Current.Web.AllUsers.GetByID(_origUserId));
                    API.Applications.CreateQuickLaunchXML(_appId, SPContext.Current.Web);
                    API.Applications.CreateTopNavXML(_appId, SPContext.Current.Web);
                }
                catch (Exception e)
                {
                    _status = "error: " + e.Message;
                }
                break;

            default:
                break;
            }
        }