Refactor common app into controller