private static SwitchStatementSyntax GetNewSwitchStatement(SwitchSectionSyntax switchSection, SwitchStatementSyntax switchStatement)
        {
            if (switchSection.GetLeadingTrivia().All(f => f.IsWhitespaceOrEndOfLineTrivia()))
            {
                int index = switchStatement.Sections.IndexOf(switchSection);

                if (index > 0)
                {
                    SwitchSectionSyntax previousSection = switchStatement.Sections[index - 1];

                    if (previousSection.GetTrailingTrivia().All(f => f.IsWhitespaceOrEndOfLineTrivia()))
                    {
                        SwitchStatementSyntax newSwitchStatement = switchStatement.RemoveNode(
                            switchSection,
                            SyntaxRemoveOptions.KeepNoTrivia);

                        previousSection = newSwitchStatement.Sections[index - 1];

                        return(newSwitchStatement.ReplaceNode(
                                   previousSection,
                                   previousSection.WithTrailingTrivia(switchSection.GetTrailingTrivia())));
                    }
                }
                else
                {
                    SyntaxToken openBrace = switchStatement.OpenBraceToken;

                    if (!openBrace.IsMissing &&
                        openBrace.TrailingTrivia.All(f => f.IsWhitespaceOrEndOfLineTrivia()))
                    {
                        return(switchStatement
                               .RemoveNode(switchSection, SyntaxRemoveOptions.KeepNoTrivia)
                               .WithOpenBraceToken(openBrace.WithTrailingTrivia(switchSection.GetTrailingTrivia())));
                    }
                }
            }

            return(switchStatement.RemoveNode(switchSection, SyntaxRemoveOptions.KeepExteriorTrivia));
        }