public function relatedCollection($resourceModel, RelatedRepository $repository)
    {
        if ($repository instanceof ConditionAwareRepository) {
            $this->applyFilters($this->filters, $this->filterFactory, $repository);
        }

        if ($repository instanceof OneToOneRelationRepository) {
            return $repository->getOne($resourceModel);
        }

        if ($repository instanceof OneToManyRelationRepository) {
            return $repository->getMany($resourceModel);
        }

        throw new \InvalidArgumentException('Repository ' . get_class($repository) . ' has no relation repository interface defined.');
    }