private void UpdateGridHeaders(Utils.Messages.GameStatsOpponentGroupByChanged obj)
 {
     this.dataGrid.Dispatcher.BeginInvoke(
         DispatcherPriority.Background,
         new Action(delegate()
     {
         UpdateGridHeadersExecute(obj);
     })
         );
 }
        private void UpdateGridHeadersExecute(Utils.Messages.GameStatsOpponentGroupByChanged obj)
        {
            foreach (var col in dynamicColumns)
            {
                this.dataGrid.Columns.Remove(col);
            }
            dynamicColumns.Clear();

            if (obj.OpponentGroupBy == "class")
            {
                CreateClassColumns();
            }
            else if (obj.OpponentGroupBy == "opponentDeckTag")
            {
                CreateTagColumns(obj.Tags);
            }
            else
            {
                throw new NotImplementedException("opponent headers missing for " + obj.OpponentGroupBy);
            }
        }