/**
  * Fav Subscribes the current user to a forum or a topic.
  *
  * @param Forum $forum The forum that is to be subscribed. Either this value or the $topic parameter must be != NULL.
  * @param Topic $topic The topic that is to be subscribed. Either this value or the $forum parameter must be != NULL.
  * @param bool $unsubscribe TRUE to unsubscribe the forum or topic instead.
  * @return void
  * @throws InvalidArgumentValueException
  * @throws NotLoggedInException
  */
 public function favSubscribeAction(Forum $forum = NULL, Topic $topic = NULL, $unsubscribe = FALSE)
 {
     // Validate arguments
     if ($forum === NULL && $topic === NULL) {
         throw new InvalidArgumentValueException("You need to subscribe a Forum or Topic!", 1285059341);
     }
     $user = $this->getCurrentUser();
     if ($user->isAnonymous()) {
         throw new NotLoggedInException('You need to be logged in to subscribe or unsubscribe an object.', 1335121482);
     }
     # Create subscription
     $object = $forum ? $forum : $topic;
     if ($unsubscribe) {
         $user->removeFavSubscription($object);
         $topic->getAuthor()->decreasePoints((int) $this->settings['rankScore']['gotFavorite']);
     } else {
         $user->addFavSubscription($object);
         $topic->getAuthor()->increasePoints((int) $this->settings['rankScore']['gotFavorite']);
     }
     # Update user and redirect to subscription object.
     $this->frontendUserRepository->update($user);
     $this->frontendUserRepository->update($topic->getAuthor());
     $this->controllerContext->getFlashMessageQueue()->enqueue(new FlashMessage($this->getSubscriptionFlashMessage($object, $unsubscribe)));
     $this->clearCacheForCurrentPage();
     $this->redirectToSubscriptionObject($object);
 }