public function update(RuleUpdateListener $listener, $id, array $input)
    {
        if (empty(array_get($input, 'expired_at'))) {
            $input['expired_at'] = null;
        }

        $rule = $this->repository->findById($id);
        $rule->fill($input);

        if (!$rule) {
            return $listener->notFound($id);
        }

        $form             = $this->presenter->form($rule);
        $validationHelper = new ValidationHelper($form, $this->validation->on('update'), $input);

        if (!$validationHelper->isValid()) {
            return $listener->updateRuleFailedValidation($validationHelper->getMessageBag(), $id);
        }
        try {
            $this->repository->update($rule);
            return $listener->updateRuleSuccess($rule);
        } catch (Exception $e) {
            Log::critical($e->getMessage());
            return $listener->updateRuleFailed(['error' => $e->getMessage()]);
        }
    }