Refactor methods to abstract logic out of controllers