/**
  * Handle
  *
  * @param Transaction             $transaction transaction
  * @param mixed                   $data        data
  * @param ConstraintViolationList $violations  violations
  *
  * @throws FeatureNotImplementedException
  * @throws \Exception
  *
  * @return CollectionResponse|CrudEntityInterface
  */
 public function handle(Transaction $transaction, $data, ConstraintViolationList $violations = null)
 {
     if (is_array($data)) {
         $data = new ArrayCollection($data);
     }
     $handled = false;
     foreach ($this->handlers as $handler) {
         if (!$handler instanceof TransactionHandlerInterface) {
             throw new \Exception('Handler must be instance of TransactionHandlerInterface');
         }
         if ($handler->supports() === $transaction->getMethod()) {
             $data = $handler->handle($transaction, $data, $violations);
             $handled = true;
         }
     }
     if (!$handled) {
         throw new FeatureNotImplementedException('Method ' . $transaction->getMethod() . ' is not supported yet.');
     }
     $data->setTransaction($transaction);
     return $data;
 }