public function addMiddleware($name)
    {
        //Support middleware in comoponents
        //pattern => App\Components\Example\Middleware\@Example;
        $parts = explode('@', $name);
        if (strcasecmp($parts[0], $name) === 0) {
            //If namespace not givent then continue to defaukt
            $namespace = "App\Middleware\\";
            $middleware = $namespace.$name;
        } else {
            //If given then continue to provided namespace
            $namespace = $parts[0];
            $middleware = $namespace.$parts[1];
        }
        $middleware_object = new $middleware();
        if (class_exists($middleware)) {
            if (method_exists($middleware_object, 'before') && method_exists($middleware_object, 'after')) {
                return $middleware;
            } else {
                throw new \Exception('Middleware methods before and after not exists', 500);
            }
        } else {
            throw new \Exception("Middleware Class {$middleware} not found", 500);
        }
    }