Refactor code to write .nsi file into separate class