public function validate_config($config)
    {
        $message = '';

        while ($message === '') {
            if (!is_dir($this->app['ROOT_DIR'] . $config['sonic.content_dir'])) {
                $message = 'Content directory does not exist';
                break;
            }

            if (!is_dir($this->app['ROOT_DIR'] . $config['sonic.plugins_dir'])) {
                $message = 'Plugins directory does not exist';
                break;
            }

            if (!is_dir($this->app['ROOT_DIR'] . $config['sonic.templates_dir'])) {
                $message = 'Templates directory does not exist';
                break;
            }

            if (
                !is_file("{$config['sonic.templates_dir']}/{$config['sonic.default_template']}")
            ) {
                $message = 'No default template exists';
            break;
            }

            if ($config['sonic.environment'] !== 'dev') {
                preg_match('#^(https?://)?([\da-z\.-]+)\.([a-z\.]{2,6})([/\w \.-]*)*/+$#', $config['site.site_root']) === 0
                    ? $message = 'Site root is invalid. Should be like http://www.example.com/'
                    : $message = '';
            }
            break;
        }

        if ($message === '') {
            return TRUE;
        }
        else {
            throw new \InvalidArgumentException($message);
        }

    }