private void ReloadControllerModels(QueryControllerModel fullQuery)
        {
            StoreParameters = fullQuery.StoreParameters;
            MainQuery       = fullQuery.MainQuery;
            //MainQuery.FromTables = fullQuery.MainQuery.FromTables;
            SubQueryList = fullQuery.SubQueryList;
            SubQueryList.Insert(0, fullQuery.MainQuery);

            //RegenerateTableLinks();
            UpdateLinksFromTableJoins();

            //MainQuery.SelectionProperties = fullQuery.MainQuery.SelectionProperties;

            foreach (var sp in MainQuery.SelectionProperties)
            {
                // var t = FindFromTable(sp.);
                var prop = sp.FromTable.Properties.SingleOrDefault(p => p.Name == sp.StoreProperty.Name);

                if (prop != null)
                {
                    prop.Selected = true;
                }
            }

            FullQuery = fullQuery;
            //MainQuery.WhereClause = fullQuery.MainQuery.WhereClause;
        }
 public void SwitchModel(QueryControllerModel model)
 {
     ReloadControllerModels(model);
 }