private void ActivateLayer(ElementsLayerSwitcher switcher, int newLayer)
 {
     Undo.RecordObject(switcher, "Changed Active Layer");
     switcher.Refresh();
     switcher.ActivateLayer(newLayer);
     Undo.undoRedoPerformed += OnUndo;
 }
        private void OnUndo()
        {
            ElementsLayerSwitcher switcher = target as ElementsLayerSwitcher;

            switcher.ActivateLayer(switcher.SelectedLayer);
        }