class PsuIdDataAuthorisationService {

    public PsuIdData getPsuIdData(String authorisationId, List<PsuIdData> psuIdDataList) {
        PsuIdData psuIdData = authorisationService.getAuthorisationById(authorisationId)
                                  .map(Authorisation::getPsuIdData)
                                  .orElse(null);
        if (psuIdData == null && !psuIdDataList.isEmpty()) {
            // This is done for multilevel accounts, since we don't know which PSU did the request, we take first one
            psuIdData = psuIdDataList.get(0);
        }
        return psuIdData != null ? psuIdData : new PsuIdData();
    }

}