/// <summary>
        /// new table
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btNewTable_Click(object sender, RoutedEventArgs e)
        {
            //create the new item
            ITableMetadata table = new TableMetadata(Catalog.CatalogMetadata);
            
            //open the window
            TableConfig window = new TableConfig(table, "");
            var ret = window.ShowDialog();
            if (!ret.HasValue || ret == false)
                return;

            //add to list
            Tables.Add(table);
            Catalog.CatalogMetadata.Tables.Add(table.TableName, table);
        }
        /// <summary>
        /// copy table
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btCopyTable_Click(object sender, RoutedEventArgs e)
        {
            //get the selected item
            if (lbTables.SelectedItem == null) return;
            ITableMetadata copy = lbTables.SelectedItem as ITableMetadata;

            //create the new item
            ITableMetadata table = new TableMetadata(Catalog.CatalogMetadata);
            BermudaConfigUtil.CopyTable(copy, table);

            //open the window
            TableConfig window = new TableConfig(table, "");
            var ret = window.ShowDialog();
            if (!ret.HasValue || ret == false)
                return;
            
            //add to list
            Tables.Add(table);
            Catalog.CatalogMetadata.Tables.Add(table.TableName, table);
        }
 /// <summary>
 /// double click on table for edit
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void lbTables_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     var item = sender as ListBoxItem;
     if (item == null || !item.IsSelected) return;
     ITableMetadata sel = item.Content as ITableMetadata;
     ITableMetadata table = new TableMetadata(Catalog.CatalogMetadata);
     BermudaConfigUtil.CopyTable(sel, table);
     TableConfig window = new TableConfig(table, table.TableName);
     var ret = window.ShowDialog();
     if (!ret.HasValue || ret.Value == false)
         return;
     BermudaConfigUtil.CopyTable(table, sel);
     lbTables.Items.Refresh();
 }