Refactor registerAppModules into service

Change-Id: I0904a9decd4ceb67b9d9cc2156e03f41a8cc30b3