protected function getRequestParams(&$source, $key = null, $default = null)
    {
        // If $key is NULL, it means that the whole $source is requested
        if (!isset($key) || $key == null) {
            $key = array_keys($source);
        }

        if (is_array($key)) {
            $output = [];
            foreach ($key as $k) {
                $output[$k] = $this->getRequestParams($source, $k);
            }

            return $output;
        }

        if (isset($source[$key])) {
            $value = $source[$key];
        } else {
            return $default;
        }

        return $value;
    }