class CmsPsuPiisServiceInternal implements CmsPsuPiisService {

    @Override
    public @NotNull List<CmsPiisConsent> getConsentsForPsu(@NotNull PsuIdData psuIdData, @NotNull String instanceId) {
        return consentJpaRepository.findAll(piisConsentEntitySpecification.byPsuDataAndInstanceId(psuIdData, instanceId)).stream()
                   .filter(con -> isPsuIdDataContentEquals(con, psuIdData))
                   .map(piisConsentLazyMigrationService::migrateIfNeeded)
                   .map(piisConsentMapper::mapToCmsPiisConsent)
                   .collect(Collectors.toList());
    }

}