private function resolveRepositoryLookup(
        LoadEntity $annotation,
        string $entityClass,
        array $mapping
    ) {
        $annotationRepository = $annotation->getRepository();
        $annotationHasRepository = !is_null($annotationRepository) && is_array($annotationRepository);
        if ($annotationHasRepository) {
            $class = $annotation->getRepository()['class'];
            $repository = $this
                    ->container
                    ->has($class)
                ? $this
                    ->container
                    ->get($class)
                : new $class();
        } else {
            $repository = $this
                ->doctrine
                ->getManagerForClass($entityClass)
                ->getRepository($entityClass);
        }

        $method = $annotationHasRepository && isset($annotationRepository['method'])
            ? $annotationRepository['method']
            : 'findOneBy';

        return $repository->$method($mapping);
    }