/// <summary>
            /// Groups fixes by the diagnostic being addressed by each fix.
            /// </summary>
            private void GroupFixes(Workspace workspace, IEnumerable<CodeFixCollection> fixCollections, IDictionary<DiagnosticData, IList<SuggestedAction>> map, IList<DiagnosticData> order, bool hasSuppressionFixes)
            {
                foreach (var fixCollection in fixCollections)
                {
                    var fixes = fixCollection.Fixes;
                    var fixCount = fixes.Length;

                    Func<CodeAction, SuggestedActionSet> getFixAllSuggestedActionSet = codeAction =>
                                CodeFixSuggestedAction.GetFixAllSuggestedActionSet(codeAction, fixCount, fixCollection.FixAllContext,
                                    workspace, _subjectBuffer, _owner._editHandler, _owner._waitIndicator);

                    foreach (var fix in fixes)
                    {
                        // Suppression fixes are handled below.
                        if (!(fix.Action is SuppressionCodeAction))
                        {
                            SuggestedAction suggestedAction;
                            if (fix.Action.HasCodeActions)
                            {
                                var nestedActions = new List<SuggestedAction>();
                                foreach (var nestedAction in fix.Action.GetCodeActions())
                                {
                                    nestedActions.Add(new CodeFixSuggestedAction(workspace, _subjectBuffer, _owner._editHandler, _owner._waitIndicator,
                                        fix, nestedAction, fixCollection.Provider, getFixAllSuggestedActionSet(nestedAction)));
                                }

                                var diag = fix.PrimaryDiagnostic;
                                var set = new SuggestedActionSet(nestedActions, SuggestedActionSetPriority.Medium, diag.Location.SourceSpan.ToSpan());

                                suggestedAction = new SuggestedAction(workspace, _subjectBuffer, _owner._editHandler, _owner._waitIndicator,
                                    fix.Action, fixCollection.Provider, new[] { set });
                            }
                            else
                            {
                                suggestedAction = new CodeFixSuggestedAction(workspace, _subjectBuffer, _owner._editHandler, _owner._waitIndicator,
                                    fix, fix.Action, fixCollection.Provider, getFixAllSuggestedActionSet(fix.Action));
                            }

                            AddFix(fix, suggestedAction, map, order);
                        }
                    }

                    if (hasSuppressionFixes)
                    {
                        // Add suppression fixes to the end of a given SuggestedActionSet so that they always show up last in a group.
                        foreach (var fix in fixes)
                        {
                            if (fix.Action is SuppressionCodeAction)
                            {
                                SuggestedAction suggestedAction;
                                if (fix.Action.HasCodeActions)
                                {
                                    suggestedAction = new SuppressionSuggestedAction(workspace, _subjectBuffer, _owner._editHandler, _owner._waitIndicator,
                                        fix, fixCollection.Provider, getFixAllSuggestedActionSet);
                                }
                                else
                                {
                                    suggestedAction = new CodeFixSuggestedAction(workspace, _subjectBuffer, _owner._editHandler, _owner._waitIndicator,
                                        fix, fix.Action, fixCollection.Provider, getFixAllSuggestedActionSet(fix.Action));
                                }

                                AddFix(fix, suggestedAction, map, order);
                            }
                        }
                    }
                }
            }
            /// <summary>
            /// Groups fixes by the diagnostic being addressed by each fix.
            /// </summary>
            private void GroupFixes(Workspace workspace, IEnumerable<CodeFixCollection> fixCollections, IDictionary<Diagnostic, IList<SuggestedAction>> map, IList<Diagnostic> order, bool hasSuppressionFixes)
            {
                foreach (var fixCollection in fixCollections)
                {
                    var fixes = fixCollection.Fixes;
                    var fixCount = fixes.Length;

                    foreach (var fix in fixes)
                    {
                        // Suppression fixes are handled below.
                        if (!(fix.Action is SuppressionCodeAction))
                        {
                            var fixAllSuggestedActionSet =
                                CodeFixSuggestedAction.GetFixAllSuggestedActionSet(fix.Action, fixCount, fixCollection.FixAllContext,
                                    workspace, _subjectBuffer, _owner._editHandler);

                            var suggestedAction = new CodeFixSuggestedAction(workspace, _subjectBuffer, _owner._editHandler,
                                fix, fixCollection.Provider, fixAllSuggestedActionSet);

                            AddFix(fix, suggestedAction, map, order);
                        }
                    }

                    if (hasSuppressionFixes)
                    {
                        // Add suppression fixes to the end of a given SuggestedActionSet so that they always show up last in a group.
                        foreach (var fix in fixes)
                        {
                            if (fix.Action is SuppressionCodeAction)
                            {
                                var suggestedAction = new SuppressionSuggestedAction(workspace, _subjectBuffer, _owner._editHandler,
                                    fix, fixCollection.Provider);

                                AddFix(fix, suggestedAction, map, order);
                            }
                        }
                    }
                }
            }