Move business logic out of http method