return Optional.ofNullable(brokerRepository.findOne(id)) .map(broker -> new ResponseEntity<>( broker, HttpStatus.OK)) .orElse(new ResponseEntity<>(HttpStatus.NOT_FOUND));