public function updateStateAction(Request $request, $transition, $graph = null)
 {
     $resource = $this->findOr404($request);
     if (null === $graph) {
         $graph = $this->stateMachineGraph;
     }
     $stateMachine = $this->get('sm.factory')->get($resource, $graph);
     if (!$stateMachine->can($transition)) {
         throw new NotFoundHttpException(sprintf('The requested transition %s cannot be applied on the given %s with graph %s.', $transition, $this->config->getResourceName(), $graph));
     }
     $stateMachine->apply($transition);
     $this->domainManager->update($resource);
     return $this->redirectHandler->redirectToReferer();
 }