protected function buildEntityService(string $modelClass): IEntityService
    {
        try {
            if (isset($this->registeredServices[$modelClass])) {
                return $this->container->make($this->registeredServices[$modelClass]);
            }

            return $this->container->make(EntityService::class, [
                'className' => $modelClass,
                'repository' => $this->repositoryFactory->getRepository($modelClass),
            ]);
        } catch (RepositoryException $exception) {
            throw new EntityServiceException($exception->getMessage(), $exception->getCode(), $exception);
        }
    }