@RequestMapping(
     value = "/speakers/{id}/speeches",
     method = GET,
     produces = MediaType.APPLICATION_JSON_VALUE)
 public Set<Speech> findBySpeakerId(@PathVariable("id") Long speakerId) {
   Speaker speaker = speakerService.findById(speakerId);
   return speechService.findBySpeaker(speaker);
 }
 @RequestMapping(
     value = "/events/{eventId}/speakers/{speakerId}/speeches",
     method = GET,
     produces = MediaType.APPLICATION_JSON_VALUE)
 public Set<Speech> findByEventAndSpeaker(
     @PathVariable("speakerId") Long speakerId, @PathVariable("eventId") Long eventId) {
   Event event = eventService.findById(eventId);
   Speaker speaker = speakerService.findById(speakerId);
   return speechService.findByEventAndSpeaker(event, speaker);
 }
 @RequestMapping(
     value = "/speakers/{speakerId}/speeches/{speechId}",
     method = PUT,
     consumes = MediaType.APPLICATION_JSON_VALUE,
     produces = MediaType.APPLICATION_JSON_VALUE)
 public void linkToSpeaker(
     @PathVariable("speechId") Long speechId, @PathVariable("speakerId") Long speakerId) {
   Speaker speaker = speakerService.findById(speakerId);
   Speech speech = speechService.findById(speechId);
   speechService.linkToSpeaker(speech, speaker);
 }
 @RequestMapping(
     value = {
       "/speakers/{speakerId}/speeches/{speechId}",
       "/speeches/{speechId}/speakers/{speakerId}"
     },
     method = DELETE,
     produces = MediaType.APPLICATION_JSON_VALUE)
 public void unlinkFromSpeaker(
     @PathVariable("speakerId") Long speakerId, @PathVariable("speechId") Long speechId) {
   Speaker speaker = speakerService.findById(speakerId);
   speechService.unlinkFromSpeaker(speechId, speaker);
 }
 @RequestMapping(
     value = "/speakers/{id}/speeches",
     method = POST,
     consumes = MediaType.APPLICATION_JSON_VALUE,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @ResponseStatus(HttpStatus.CREATED)
 public Speech createAndLinkToSpeaker(
     @PathVariable("id") Long speakerId, @RequestBody @Validated Speech speech) {
   speech.setId(null);
   Speaker speaker = speakerService.findById(speakerId);
   return speechService.createAndLinkToSpeaker(speech, speaker);
 }
 @RequestMapping(
     value = "/events/{eventId}/speakers/{speakerId}/speeches",
     method = POST,
     produces = MediaType.APPLICATION_JSON_VALUE)
 public Speech createAndLinkToEventSpeaker(
     @PathVariable("speakerId") Long speakerId,
     @PathVariable("eventId") Long eventId,
     @RequestBody @Validated Speech speech) {
   Event event = eventService.findById(eventId);
   Speaker speaker = speakerService.findById(speakerId);
   return speechService.createAndLinkToEventSpeaker(speech, speaker, event);
 }
 @RequestMapping(
     value = "/events/{eventId}/speakers/{speakerId}/speeches/{speechId}",
     method = RequestMethod.DELETE,
     produces = MediaType.APPLICATION_JSON_VALUE)
 public void removeFromEventSpeaker(
     @PathVariable("eventId") Long eventId,
     @PathVariable("speakerId") Long speakerId,
     @PathVariable("speechId") Long speechId) {
   Event event = eventService.findById(eventId);
   Speaker speaker = speakerService.findById(speakerId);
   Speech speech = speechService.findById(speechId);
   speechService.unlinkFromEventSpeaker(speech, speaker, event);
 }