private static bool TryGetAction(SyntaxNode syntaxNode, SyntaxNode root, RedundantDeclaration.RedundancyType diagnosticType,
     Document document, out CodeAction action)
 {
     switch (diagnosticType)
     {
         case RedundantDeclaration.RedundancyType.LambdaParameterType:
             return TryGetRedundantLambdaParameterAction(syntaxNode, root, document, out action);
         case RedundantDeclaration.RedundancyType.ArraySize:
             return TryGetRedundantArraySizeAction(syntaxNode, root, document, out action);
         case RedundantDeclaration.RedundancyType.ArrayType:
             return TryGetRedundantArrayTypeAction(syntaxNode, root, document, out action);
         case RedundantDeclaration.RedundancyType.ExplicitDelegate:
         case RedundantDeclaration.RedundancyType.ExplicitNullable:
             return TryGetRedundantExplicitObjectCreationAction(syntaxNode, root, document, diagnosticType, out action);
         case RedundantDeclaration.RedundancyType.ObjectInitializer:
             return TryGetRedundantObjectInitializerAction(syntaxNode, root, document, out action);
         case RedundantDeclaration.RedundancyType.DelegateParameterList:
             return TryGetRedundantParameterTypeAction(syntaxNode, root, document, out action);
         default:
             throw new NotSupportedException();
     }
 }
        private static bool TryGetRedundantExplicitObjectCreationAction(SyntaxNode syntaxNode, SyntaxNode root,
            Document document, RedundantDeclaration.RedundancyType diagnosticType,  out CodeAction action)
        {
            var title = diagnosticType == RedundantDeclaration.RedundancyType.ExplicitDelegate
                ? TitleRedundantExplicitDelegate
                : TitleRedundantExplicitNullable;

            var objectCreation = syntaxNode as ObjectCreationExpressionSyntax;
            if (objectCreation == null)
            {
                action = null;
                return false;
            }

            var newExpression = objectCreation.ArgumentList?.Arguments.FirstOrDefault()?.Expression;
            if (newExpression == null)
            {
                action = null;
                return false;
            }

            action = CodeAction.Create(title, c =>
            {
                newExpression = newExpression.WithTriviaFrom(objectCreation);
                var newRoot = root.ReplaceNode(objectCreation, newExpression);
                return Task.FromResult(document.WithSyntaxRoot(newRoot));
            }, title);
            return true;
        }