public function sanitize($input)
    {
        foreach ($this->rawRules as $rule) {
            if ($rule instanceof Attributes) {
                $config = [
                    'remainder' => $this->remainder,
                    'recursive' => $this->recursive
                ];
                Instance::configure($rule, $config);
                return $rule->sanitize($input);
            }
            $input = $rule->sanitize($input);

            if ($rule->recursive && (is_array($input) || is_object($input))) {
                $config['attributes'] = $this;
                return (new Attributes($config))->sanitize($input);
            }
        }

        return $input;
    }