private function normalizeAsset(FileAssetInterface $asset)
    {
        $path = $asset->getPath();
        if ($path === null) {
            throw new \RuntimeException('Extension file assets must have a path set.');
        }

        if ($asset->getPackageName()) {
            return;
        }

        if ($this->isAbsoluteUrl($path)) {
            // Set asset to a package, since there is no default.
            // It doesn't matter which since it is absolute.
            $asset->setPackageName('extensions');

            return;
        }

        $file = $this->getWebDirectory()->getFile($asset->getPath());
        if ($file->exists()) {
            $asset->setPackageName('extensions')->setPath($file->getPath());

            return;
        }

        $app = $this->getContainer();
        $filesystem = $app['filesystem'];

        $publicFile = $filesystem->getFile("web://$path");
        if ($publicFile->exists()) {
            $asset->setPackageName('web');

            return;
        }

        $themeFile = $filesystem->getFile("theme://$path");
        if ($themeFile->exists()) {
            $asset->setPackageName('theme');

            return;
        }

        $message = sprintf(
            "Couldn't add file asset '%s': File does not exist in %s, %s or %s directories. Make sure the file " .
            'exists in one of these locations, by placing the file there manually (for Bundled Extensions) or by ' .
            'uninstalling and reinstalling the extension again (for Managed Extensions).',
            $asset->getPath(),
            $file->getFullPath(),
            $publicFile->getFullPath(),
            $themeFile->getFullPath()
        );
        $app['logger.system']->error($message, ['event' => 'extensions']);
    }