protected function buildParametersForResolver($resolver, array $parents, array $defaultParameters)
    {
        $reflector = $this->getCallReflector($resolver);

        $parameters = $reflector->getParameters();
        $defaultParameters = array_reverse($defaultParameters);

        return array_map(function (\ReflectionParameter $parameter) use (&$defaultParameters, $parents) {
            $parameterClass = $parameter->getClass();

            // If the parameter doesn't have a class then it isn't type hinted
            // and thus no need for dependency injection.
            if ($parameterClass === null) {
                return array_pop($defaultParameters);
            }

            $fetched = $this->findFetchedResource($parameter, $parameterClass);

            if ($fetched !== null) {
                return $fetched;
            }

            // If the parameter asks for a dependency then check parents first
            // and then fallback to the application IOC
            $parent = $this->findParent($parameterClass, $parents);

            if ($parent !== null) {
                return $parent;
            }

            foreach ($this->customParameterResolvers as $parameterResolver) {
                $resolved = $this->callResolver(
                    $parameterResolver,
                    [
                        $parameter,
                        Arr::get($this->resource, 'id'),
                        Arr::get($this->resource, 'type'),
                    ]
                );

                if ($resolved !== null) {
                    return $resolved;
                }
            }

            if ($this->container->has($parameterClass->getName())) {
                return $this->container->get($parameterClass->getName());
            }

            return null;
        }, $parameters);
    }