public function &getService($service)
    {

        $classServiceName = basename($service);
        if (isset($this->$classServiceName)) {
            return $this->$classServiceName;
        } else {
            $service = ucfirst($service);
            $factoryClass = $service . "Factory";

            if (class_exists($factoryClass)) {
                $factory = new $factoryClass();
                if ($factory instanceof ServiceFactory) {
                    if (!$this->isUnderConstruction($service)) {
                        $this->underConstruction($service);
                        $newService = $factory->create();
                        $this->constructed($service);
                    } else {
                        if(isset($this->proxyObjects[$classServiceName])) {
                            return $this->proxyObjects[$classServiceName];
                        }else{
                            return $this->$classServiceName;
                        }
                    }

                    $this->$classServiceName = $newService;
                    return $newService;
                }
            }

            if (!$this->isUnderConstruction($service)) {
                $this->underConstruction($service);
                $object = new $service();
                if ($object instanceof ServiceFactory) {
                    $newService = $object->create();
                } else {
                    $newService = $object;
                }
                $this->constructed($service);
            } else {
                if(isset($this->proxyObjects[$classServiceName])) {
                    return $this->proxyObjects[$classServiceName];
                }else{
                    return $this->$classServiceName;
                }
            }

            $this->$classServiceName = $newService;
            return $newService;
        }
    }