public function render($nameOrModel, array $variables = [])
    {
        $__module = null;

        if ($nameOrModel instanceof ViewModelInterface) {
            $model       = $nameOrModel;
            $nameOrModel = $model->getTemplate();
            $__module    = $model->getModule();
            $variables   = array_merge($model->getVariables(), $variables);
            unset($model);
        } elseif (! is_string($nameOrModel)) {
            throw new InvalidArgumentException(sprintf(
                'Invalid render source provided; must be a string or instance '
                . 'of "%s", "%s" received.',
                ViewModelInterface::CLASS,
                is_object($nameOrModel) ? get_class($nameOrModel)
                                        : gettype($nameOrModel)
            ));
        }

        extract($variables);
        $__old = $this->setVariables($variables);
        unset($variables);

        try {
            ob_start();
            include $this->getResolver()->resolve($nameOrModel, $__module);
            $__return = ob_get_clean();
        } catch (Error $e) {
            ob_end_clean();
            throw $e;
        } catch (Exception $e) {
            ob_end_clean();
            throw $e;
        }
        $this->setVariables($__old);

        return $__return;
    }