/**
     * Resolve parameters referencing other services
     * 
     * @param  array $params 
     * @return array
     */
    protected function resolveMethodParameters($class, $method, array $userParams, $isInstantiator, $alias)
    {
        $resolvedParams = array();
        
        $injectionMethodParameters = $this->definition->getInjectionMethodParameters($class, $method);
        
        $computedValueParams = array();
        $computedLookupParams = array();
        
        foreach ($injectionMethodParameters as $name => $type) {
            //$computedValueParams[$name] = null;
            
            // first consult user provided parameters
            if (isset($userParams[$name])) {
                if (is_string($userParams[$name])) {
                    if ($this->instanceManager->hasAlias($userParams[$name])) {
                        $computedLookupParams[$name] = array($userParams[$name], $this->instanceManager->getClassFromAlias($userParams[$name]));    
                    } elseif ($this->definition->hasClass($userParams[$name])) {
                        $computedLookupParams[$name] = array($userParams[$name], $userParams[$name]);
                    } else {
                        $computedValueParams[$name] = $userParams[$name];
                    }
                } else {
                    $computedValueParams[$name] = $userParams[$name];
                }
                continue;
            }
            
            // next consult alias specific properties
            if ($alias && $this->instanceManager->hasProperty($alias, $name)) {
                $computedValueParams[$name] = $this->instanceManager->getProperty($alias, $name);
                continue;
            }
            
            // next consult alias level preferred instances
            if ($alias && $this->instanceManager->hasPreferredInstances($alias)) {
                $pInstances = $this->instanceManager->getPreferredInstances($alias);
                foreach ($pInstances as $pInstance) {
                    $pInstanceClass = ($this->instanceManager->hasAlias($pInstance)) ?
                         $this->instanceManager->getClassFromAlias($pInstance) : $pInstance;
                    if ($pInstanceClass === $type || is_subclass_of($pInstanceClass, $type)) {
                        $computedLookupParams[$name] = array($pInstance, $pInstanceClass);
                        continue;
                    }
                }
            }
            
            // next consult class level preferred instances
            if ($type && $this->instanceManager->hasPreferredInstances($type)) {
                $pInstances = $this->instanceManager->getPreferredInstances($type);
                foreach ($pInstances as $pInstance) {
                    $pInstanceClass = ($this->instanceManager->hasAlias($pInstance)) ?
                         $this->instanceManager->getClassFromAlias($pInstance) : $pInstance;
                    if ($pInstanceClass === $type || is_subclass_of($pInstanceClass, $type)) {
                        $computedLookupParams[$name] = array($pInstance, $pInstanceClass);
                        continue;
                    }
                }
            }
            
            // finally consult alias specific properties
            if ($this->instanceManager->hasProperty($class, $name)) {
                $computedValueParams[$name] = $this->instanceManager->getProperty($class, $name);
                continue;
            }
            
            if ($type) {
                $computedLookupParams[$name] = array($type, $type);
            }
            
        }

        $index = 0;
        foreach ($injectionMethodParameters as $name => $value) {
            
            if (isset($computedValueParams[$name])) {
                $resolvedParams[$index] = $computedValueParams[$name];
            } elseif (isset($computedLookupParams[$name])) {
                if ($isInstantiator && in_array($computedLookupParams[$name][1], $this->currentDependencies)) {
                    throw new Exception\CircularDependencyException("Circular dependency detected: $class depends on $value and viceversa");
                }
                array_push($this->currentDependencies, $class);
                $resolvedParams[$index] = $this->get($computedLookupParams[$name][0], $userParams);
                array_pop($this->currentDependencies);
            } else {
                throw new Exception\MissingPropertyException('Missing parameter named ' . $name . ' for ' . $class . '::' . $method);
            }
            
            $index++;
        }

        return $resolvedParams;
    }