private function getLayoutPath($layout = null, $fromTheme = false) {
        $layout = ($layout === null) ? $this->view->getController()->getLayout() : $layout;
        if (!$layout)
            return false;

        if (!$fromTheme && is_readable(MODULES . $this->view->getModule() . DIRECTORY_SEPARATOR . 'View' .
                        DIRECTORY_SEPARATOR . 'layouts' . DIRECTORY_SEPARATOR . $layout .
                        '.phtml'))
            return MODULES . $this->view->getModule() . DIRECTORY_SEPARATOR . 'View' .
                    DIRECTORY_SEPARATOR . 'layouts' . DIRECTORY_SEPARATOR . $layout .
                    '.phtml';
        elseif (is_readable(THEMES . engineGet('config', 'defaults', 'theme') .
                        DIRECTORY_SEPARATOR . 'layouts' . DIRECTORY_SEPARATOR . $layout . '.phtml'))
            return THEMES . engineGet('config', 'defaults', 'theme') . DIRECTORY_SEPARATOR .
                    'layouts' . DIRECTORY_SEPARATOR . $layout . '.phtml';
        else {
            throw new Exception('Layout "' . $layout . '" not found both at the module and theme levels');
        }
    }