class PsuDataMapper {

    public PsuData mapToPsuData(PsuIdData psuIdData, String instanceId) {
        return Optional.ofNullable(psuIdData)
                   .filter(PsuIdData::isNotEmpty)
                   .map(psu -> new PsuData(
                       psu.getPsuId(),
                       psu.getPsuIdType(),
                       psu.getPsuCorporateId(),
                       psu.getPsuCorporateIdType(),
                       psu.getPsuIpAddress(),
                       mapToAdditionalPsuData(psu.getAdditionalPsuIdData())
                   ))
                   .map(psu -> setInstanceId(psu, instanceId))
                   .orElse(null);
    }

}