Here is a step-by-step refactoring activity where I used of the Roslyn example methods (the AddingMethodToClass which shows how to "replace a class inside a namespace") and rewrote it using O2's Roslyn APIs (adding a bunch of Extension methods on the way)
This is what the refactored code looks like:
This is what the original code looks like:
This is a smaller version of the refactored code:
Here is a document that shows how the refactored code was created: