class PunishmentService {

    public PunishResult punish(PunishmentParameters punishmentParameters, PunishmentType punishmentType) {
        return playerProfileRepository.find(new PlayerNameSpecification(punishmentParameters.getTargetName()))
                .map(playerProfile -> {
                    PunishmentRecord punishmentRecord = new PunishmentRecord(punishmentParameters.getPunisher(), playerProfile, punishmentParameters.getReason(), punishmentType);
                    punishmentRepository.savePunishment(punishmentRecord);
                    return new PunishResult(punishmentRecord, PunishResultType.OK);
                }).orElse(PunishResult.NOT_FOUND);
    }

}