private function loadEntityMapping(): array
	{
		$mapping = [];

		$builder = $this->getContainerBuilder();
		$repositories = $builder->findByType(IRepository::class);

		foreach ($repositories as $repository) {
			/** @var string $repositoryClass */
			$repositoryClass = $repository->getEntity();

			// Skip invalid repositoryClass name
			if (!class_exists($repositoryClass)) {
				throw new ServiceCreationException(sprintf("Repository class '%s' not found", $repositoryClass));
			}

			// Skip invalid subtype ob IRepository
			if (!method_exists($repositoryClass, 'getEntityClassNames')) continue;

			// Append mapping [repository => [entity1, entity2, entityN]
			foreach ($repositoryClass::getEntityClassNames() as $entity) {
				$mapping[$entity] = $repositoryClass;
			}
		}

		return $mapping;
	}