protected function resolve($filename, $scope)
    {
        $scopeIndex = ($scope === false)? '' : $scope;
        $theme = $this->getCurrentTheme();
        $url = false;

        if (isset($this->locations[$theme][$scopeIndex][$filename])) {
            return $this->locations[$theme][$scopeIndex][$filename];
        }

        if ($this->publishingStrategy) {
            $url = $this->publishingStrategy->find($filename, $scope, $this->getTheme());
        }

        if ($url === false) {
            if (!$this->router) {
                throw new exception\DependencyException('Missing router instance to build dynamic resource url');
            }

            $routeOptions = array(
                'name' => 'rampage.core.resources',
            );

            $routeParams = array(
                'theme' => $theme,
                'scope' => ($scope? : '__theme__'),
                'file' => $filename
            );

            $url = $this->router->assemble($routeParams, $routeOptions);

            if ($this->baseUrl) {
                $url = $this->baseUrl->getUrl($url);
            }
        }

        $this->locations[$theme][$scopeIndex][$filename] = $url;
        return $url;
    }