public function saveAction()
 {
     if (!Identity::isAuthenticated()) {
         return $this->redirect(UserController::ROUTE_LOGIN);
     }
     $followingsTable = $this->getFollowingTable();
     $collection = new FollowingCollection($_POST[self::FOLLOWINGS_FIELDSET_NAME]);
     $user_id = Identity::getId();
     if (!$user_id) {
         throw new \Exception("Error occurred. Unable to fetch signed user id.");
     }
     foreach ($collection as $item) {
         $following_name = $item->getFollowingName();
         if ($item->getFollowingId() && $following_name) {
             $followingsTable->saveFollowing($item, $user_id);
         } else {
             if ($item->getId() && empty($following_name)) {
                 $followingsTable->deleteFollowing($item->getId(), $user_id);
             }
         }
     }
     return $this->redirect('/');
 }
 public function logoutAction()
 {
     Identity::clearAuth();
     return $this->redirect('/');
 }