/// <summary>
    /// Edits the selected application.
    /// </summary>
    private void EditApplication()
    {
        // Need to get the selected domain
        Domain domain = applicationListCtl.GetSelectedDomain();

        ApplicationEntryDlg dlg = new ApplicationEntryDlg();

        if (dlg.DoModal(this, domain))
        {
            log.Info("OK pressed on ApplicationEntryDlg");
            if (domain.Dirty)
            {
                if (ConfigurationManager.AppSettings[DISPLAY_SQL_CFG].Equals("true"))
                {
                    BufferDisplayDlg bdDlg = new BufferDisplayDlg();
                    bdDlg.DoModal(this, domain);
                }
                if (ConfigurationManager.AppSettings[UPDATE_DB_CFG].Equals("true"))
                {
                    domain.Save();
                }
                applicationListCtl.UpdateSelectedLabel();
            }
        }
        log.DebugFormat("Application Name: {0}", domain.GetValue("Name"));
    }
    /// <summary>
    /// Adds a new application.
    /// </summary>
    private void AddApplication()
    {
        // Create a new Application domain
        Domain domain = DomainFactory.Create("Application");

        ApplicationEntryDlg dlg = new ApplicationEntryDlg();

        if (dlg.DoModal(this, domain))
        {
            log.Info("OK pressed on ApplicationEntryDlg");
            if (ConfigurationManager.AppSettings[DISPLAY_SQL_CFG].Equals("true"))
            {
                BufferDisplayDlg bdDlg = new BufferDisplayDlg();
                bdDlg.DoModal(this, domain);
            }
            if (ConfigurationManager.AppSettings[UPDATE_DB_CFG].Equals("true"))
            {
                domain.Save();
            }

            applicationListCtl.AddDomain(domain);
        }
    }