using (UndoRedoManager.Start("My Root Command"))
using (UndoRedoManager.Start("My Nested Command"))
You can put part of a job inside the nested command and then cancel it if error occured without canceling parent command.
Commands hierarchy can be of any depth. Some of commands can be commited and some of them can be rolled back. All the changes made in these commands will be put in the history when root command commited.
So, despite the number of nested commands you will see the only one root command in history containing all changes accumulated.