public void RemoveFromTable(string tableName, string alias)
        {
            var table = FromTables.Single(t => t.Alias == alias && t.StoreDefinition.Name == tableName);

            FromTables.Remove(table);
            RegenerateTableLinks();
        }
        public void AliasChanged(string oldAlias, string newAlias)
        {
            var table = FromTables.Single(t => t.Alias == oldAlias);

            table.Alias = newAlias;

            foreach (var j in FromTableJoins)
            {
                if (j.Source.LeftObjectAlias == oldAlias)
                {
                    j.Source.LeftObjectAlias = newAlias;
                }

                if (j.Source.RightObjectAlias == oldAlias)
                {
                    j.Source.RightObjectAlias = newAlias;
                }
            }
        }