private void AddFilter(Filter filter) {
      Content.Filters.Add(filter);
      int rowIndex = Content.Filters.Count;

      tableLayoutPanel.SuspendLayout();
      tableLayoutPanel.RowCount++;
      tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.AutoSize));

      Button removeButton = new Button();
      removeButton.Size = new System.Drawing.Size(24, 24);
      removeButton.Anchor = AnchorStyles.Top | AnchorStyles.Right;
      removeButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Remove;
      removeButton.Tag = filter;
      removeButton.Click += new System.EventHandler(removeButton_Click);
      tableLayoutPanel.Controls.Add(removeButton, 0, rowIndex);

      ContentView filterView = (ContentView)MainFormManager.CreateDefaultView(filter.GetType());
      filterView.Content = filter;
      filterView.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
      tableLayoutPanel.Controls.Add(filterView, 1, rowIndex);

      tableLayoutPanel.ResumeLayout();
    }
    private void RemoveFilter(Filter filter) {
      int rowIndex = Content.Filters.IndexOf(filter) + 1;
      Content.Filters.Remove(filter);

      tableLayoutPanel.SuspendLayout();
      Control removeButton = tableLayoutPanel.GetControlFromPosition(0, rowIndex);
      Control filterView = tableLayoutPanel.GetControlFromPosition(1, rowIndex);
      tableLayoutPanel.Controls.Remove(removeButton);
      removeButton.Dispose();
      tableLayoutPanel.Controls.Remove(filterView);
      filterView.Dispose();

      for (int i = rowIndex + 1; i < tableLayoutPanel.RowCount; i++) {
        tableLayoutPanel.SetRow(tableLayoutPanel.GetControlFromPosition(0, i), i - 1);
        tableLayoutPanel.SetRow(tableLayoutPanel.GetControlFromPosition(1, i), i - 1);
      }

      tableLayoutPanel.RowCount--;
      tableLayoutPanel.RowStyles.RemoveAt(rowIndex);
      tableLayoutPanel.ResumeLayout();
    }