public string GetConfigurationTemplate(string template, IDictionary <string, string> parameters)
        {
            var settings = Settings.Parse(template);

            new Populator(parameters).Populate(settings);
            CheckBox UseConnectionVariables = (CheckBox)settings.Find("UseConnectionVariables");
            TextBox  SQLServer = settings.Find("SQLServer") as TextBox;

            SQLServer.HelpText = string.Empty;
            TextBox SQLUser = settings.Find("SQLUser") as TextBox;

            SQLServer.Visible = SQLUser.Visible = (UseConnectionVariables.Value == false);
            CheckBox SQLUseSQLAuth = settings.Find("SQLUseSQLAuth") as CheckBox;
            TextBox  SQLPassword   = settings.Find("SQLPassword") as TextBox;

            SQLPassword.Visible = !UseConnectionVariables.Value && SQLUseSQLAuth.Value;
            VariableBox vSQLServer = settings.Find("vSQLServer") as VariableBox;

            vSQLServer.HelpText = string.Empty;
            VariableBox vSQLUser = settings.Find("vSQLUser") as VariableBox;

            vSQLServer.Visible = vSQLUser.Visible = (UseConnectionVariables.Value == true);
            VariableBox vSQLPassword = settings.Find("vSQLPassword") as VariableBox;

            vSQLPassword.Visible = UseConnectionVariables.Value && SQLUseSQLAuth.Value;
            string errorMessage = "";

            TextBox sqlServer   = SQLServer;
            TextBox sqlUser     = SQLUser;
            TextBox sqlPassword = SQLPassword;

            if (UseConnectionVariables.Value)
            {
                sqlServer = new TextBox()
                {
                    Value = GetVariableValue(vSQLServer.Value)
                };
                sqlUser = new TextBox()
                {
                    Value = GetVariableValue(vSQLUser.Value)
                };
                if (SQLUseSQLAuth.Value)
                {
                    sqlPassword = new TextBox()
                    {
                        Value = GetVariableValue(vSQLPassword.Value)
                    }
                }
                ;
            }

            IList <string> databases   = SQLHelpers.GetDatabases(sqlServer, sqlUser, SQLUseSQLAuth, this.decrypt(sqlPassword.Value), out errorMessage);
            DropDown       SQLDatabase = settings.Find("SQLDatabase") as DropDown;

            SQLDatabase.Options = databases.Select(i => new Option()
            {
                DisplayMemeber = i, ValueMemeber = i
            }).ToList();

            CheckBox UsingStoredProc = settings.Find("UsingStoredProc") as CheckBox;
            DropDown StoredProc      = settings.Find("StoredProc") as DropDown;
            CheckBox CreateTable     = settings.Find("CreateTable") as CheckBox;
            TextBox  SQLTableNew     = settings.Find("SQLTableNew") as TextBox;
            DropDown SQLTable        = settings.Find("SQLTable") as DropDown;
            CheckBox AllowTriggers   = settings.Find("AllowTriggers") as CheckBox;

            if (UsingStoredProc.Value == true)
            {
                StoredProc.Visible  = true;
                CreateTable.Visible = SQLTableNew.Visible = SQLTable.Visible = AllowTriggers.Visible = false;
            }
            else
            {
                StoredProc.Visible  = false;
                CreateTable.Visible = AllowTriggers.Visible = true;
                SQLTableNew.Visible = (CreateTable.Value == true);
                SQLTable.Visible    = (CreateTable.Value == false);
            }

            if (!String.IsNullOrWhiteSpace(SQLDatabase.Value))
            {
                IList <string> tables = SQLHelpers.GetTables(sqlServer, sqlUser, SQLUseSQLAuth, this.decrypt(sqlPassword.Value), SQLDatabase, out errorMessage);
                SQLTable.Options = tables.Select(i => new Option()
                {
                    DisplayMemeber = i, ValueMemeber = i
                }).ToList();
                if (tables.Contains(SQLTable.Value) == false)
                {
                    SQLTable.Value = "";
                }

                var storedprocs = SQLHelpers.GetStoredProcs(sqlServer, sqlUser, SQLUseSQLAuth, this.decrypt(sqlPassword.Value), SQLDatabase, out errorMessage);
                StoredProc.Options = storedprocs.Select(i => new Option()
                {
                    DisplayMemeber = i, ValueMemeber = i
                }).ToList();
                if (storedprocs.Contains(StoredProc.Value) == false)
                {
                    StoredProc.Value = "";
                }
            }

            if (!String.IsNullOrWhiteSpace(errorMessage))
            {
                SQLServer.HelpText = vSQLServer.HelpText = errorMessage;
            }

            return(settings.ToString());
        }