/**
  * Deactivates branch updates subscription for the current user
  *
  * @param id identifies topic to unsubscribe from
  * @throws NotFoundException if no object is found for id given
  */
 @RequestMapping("topics/{id}/unsubscribe")
 @ResponseBody
 public ModelAndView unsubscribeFromTopic(
     @PathVariable Long id,
     @RequestHeader(value = "X-Requested-With", defaultValue = "NotAjax") String header)
     throws NotFoundException {
   Topic topic = topicFetchService.get(id);
   subscriptionService.toggleTopicSubscription(topic);
   if (header.equals("NotAjax")) {
     // redirect to new page
     return new ModelAndView("redirect:/topics/" + id);
   } else {
     // no redirecting, perform AJAX request
     return null;
   }
 }