Code for starting and stopping eager service in AppController