private void UpdateSelectedGroup()
 {
     if (SelectedGroup != null)
     {
         SelectedGroup = SelectedMachines?.SelectMany(machine => ConnectionStore.Connections.Values
                                                      .First(connection => ProcessManager.DataObjects.Comparers.Comparer <Machine> .IDObjectsEqual(connection.Machine, machine))
                                                      .Configuration
                                                      .Groups)
                         .FirstOrDefault(group => Comparer.GroupsEqual(group, SelectedGroup));
     }
     UpdateLinkLabelGroup();
 }
        private void UpdateMacroActionBundle()
        {
            ActionBundle.Actions.Clear();
            if (HasValidSelections)
            {
                ActionBundle.Actions.AddRange(SelectedMachines.SelectMany(machine => SelectedApplications
                                                                          .Select(application =>
                {
                    Configuration configuration   = ConnectionStore.Connections[machine].Configuration;
                    Group actualGroup             = configuration.Groups.FirstOrDefault(x => Comparer.GroupsEqual(x, SelectedGroup));
                    Application actualApplication = configuration.Applications.FirstOrDefault(x => Comparer.ApplicationsEqual(x, application));
                    return(actualGroup != null && actualApplication != null ? new MacroProcessAction(ActionBundle.Type, machine.ID, actualGroup.ID, actualApplication.ID) : null);
                })
                                                                          .Where(action => action != null)));
            }

            RaiseMacroActionItemChangedEvent();
        }