[Refactoring] Moved import statement generation to a separate method.