public function getRepositoryFor($entityClass)
    {
        if (!is_subclass_of($entityClass, EntityInterface::class)) {
            throw new InvalidArgumentException(
                'Cannot create ORM repository for a class that does not '.
                'implement EntityInterface.'
            );
        }

        return $this->repositories->containsKey($entityClass)
            ? $this->repositories->get($entityClass)
            : $this->createRepository($entityClass);
    }