public static void ExecuteEditCommand(SqlDocumentRepository documentRepository, SqlTextEditor editor, Action <ActionExecutionContext> executionHandler) { if (editor.IsReadOnly || !String.Equals(documentRepository.StatementText, editor.Text)) { return; } var executionContext = ActionExecutionContext.Create(editor, documentRepository); try { executionHandler(executionContext); UpdateDocument(editor, executionContext); } catch (Exception exception) { App.LogErrorAndShowMessage(exception); } }