public function checkRules(EntityInterface $entity, $operation = RulesChecker::CREATE, $options = null)
    {
        $rules = $this->rulesChecker();
        $options = $options ?: new ArrayObject();
        $options = is_array($options) ? new ArrayObject($options) : $options;
        $hasEvents = ($this instanceof EventDispatcherInterface);

        if ($hasEvents) {
            $event = $this->dispatchEvent(
                'Model.beforeRules',
                compact('entity', 'options', 'operation')
            );
            if ($event->isStopped()) {
                return $event->getResult();
            }
        }

        $result = $rules->check($entity, $operation, $options->getArrayCopy());

        if ($hasEvents) {
            $event = $this->dispatchEvent(
                'Model.afterRules',
                compact('entity', 'options', 'result', 'operation')
            );

            if ($event->isStopped()) {
                return $event->getResult();
            }
        }

        return $result;
    }