public function loadRoutes(App $slim, array $routes)
    {
        foreach ($routes as $name => $details) {
            if ($children = $this->nullable('routes', $details)) {
                $middlewares = $this->nullable('stack', $details) ?: [];
                $prefix = $this->nullable('route', $details) ?: '';

                $loader = [$this, 'loadRoutes'];
                $groupLoader = function () use ($slim, $children, $loader) {
                    $loader($slim, $children);
                };

                $group = $slim->group($prefix, $groupLoader);
                while ($mw = array_pop($middlewares)) {
                    $group->add($mw);
                }

            } else {
                $this->loadRoute($slim, $name, $details);
            }
        }
    }