Using indent method to refactor controller generator.

[John J. Wang & Prathamesh Sonpatki]
Merge pull request #12093 from wangjohn/indentation_in_generator

Using indent method to refactor controller generator.