/**
  * 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;
   }
 }
 /**
  * Activates branch updates subscription for the current user. This includes topic creation,
  * removal and all topic updates
  *
  * @param id identifies branch to subscribe to
  * @throws NotFoundException if no object is found for id given
  */
 @RequestMapping("branches/{id}/subscribe")
 @ResponseBody
 public ModelAndView subscribeToBranch(
     @PathVariable Long id,
     @RequestHeader(value = "X-Requested-With", defaultValue = "NotAjax") String header)
     throws NotFoundException {
   Branch branch = branchService.get(id);
   subscriptionService.toggleBranchSubscription(branch);
   if (header.equals("NotAjax")) {
     // redirect to new page
     return new ModelAndView("redirect:/branches/" + id);
   } else {
     // no redirecting, perform AJAX request
     return null;
   }
 }