use state machine from controller and handle exception