protected function addControls(Response &$response, Request $request, View $view)
    {
        $matches = array();
        
        while (preg_match("/\{(\w+)=(\w+)\}/", $response->getBody(), $matches)) {
            $controlIdentifier = $matches[1];
            $controlName = $matches[2];
            $currentBody = $response->getBody();
            
            if (! isset($this->viewParams[$controlIdentifier][$controlName])
				|| ! $view->hasControl($controlIdentifier)) {
                $response->setBody(str_replace($matches[0], '', $currentBody));
                continue;
            }
            
            if ($this->viewParams[$controlIdentifier][$controlName] instanceof Control) {
                $repl = $this->viewParams[$controlIdentifier][$controlName]->render($request);
            } else {
                $control = $view->createControl($controlIdentifier);
                $repl = $control->render($request, $this->viewParams[$controlIdentifier][$controlName]);
            }
            $response->setBody(str_replace($matches[0], $repl, $currentBody));
        }
    }