public function bag(string $name): InputBag
    {
        // ensure proper request association
        $this->request();

        if (isset($this->bags[$name])) {
            return $this->bags[$name];
        }

        if (!isset($this->bagAssociations[$name])) {
            throw new InputException("Undefined input bag '{$name}'");
        }

        $class = $this->bagAssociations[$name]['class'];
        $data = call_user_func([$this->request(), $this->bagAssociations[$name]['source']]);

        if (!is_array($data)) {
            $data = (array)$data;
        }

        return $this->bags[$name] = new $class($data, $this->prefix);
    }