class CountriesService {

    public void setSelectedCountry(SessionId sessionId, String countryCode) {
        ensureTransactionSupportsEidas(sessionId);

        List<EidasCountryDto> supportedCountries = getCountries(sessionId);
        EidasCountryDto selectedCountry = supportedCountries.stream()
            .filter(country -> country.getSimpleId().equals(countryCode))
            .findFirst()
            .orElseThrow(() -> new EidasCountryNotSupportedException(sessionId, countryCode));

        EidasCountrySelectingStateController eidasCountrySelectingStateController = (EidasCountrySelectingStateController) sessionRepository.getStateController(sessionId, EidasCountrySelectingState.class);
        eidasCountrySelectingStateController.selectCountry(selectedCountry.getEntityId());
    }

    @Inject public  CountriesService(SessionRepository sessionRepository, TransactionsConfigProxy configProxy);

}