class CardAccountModelMapper {

    public CardAccountList mapToCardAccountList(Xs2aCardAccountListHolder xs2aCardAccountListHolder) {
        List<Xs2aCardAccountDetails> accountDetailsList = xs2aCardAccountListHolder.getCardAccountDetails();

        List<CardAccountDetails> details = accountDetailsList.stream()
                                               .map(this::mapToCardAccountDetails)
                                               .collect(Collectors.toList());
        return new CardAccountList().cardAccounts(details);
    }

}