/// <summary>
        /// Subscribes the logged in user to another user.
        /// </summary>
        /// <param name="userId">The user to subscribe to</param>
        /// <returns>The result page.</returns>
        public ActionResult AddSubscriber(int userId)
        {
            if (userId == (int)Membership.GetUser().ProviderUserKey)
            {
                ViewBag.Message = "You cannot follow yourself.";
                ViewBag.Color = "Red"; //Background color to display...
                return View("Result");
            }

            User_Subscriber us = new User_Subscriber
            {
                UserId = (int)Membership.GetUser().ProviderUserKey,
                SubscriberId = userId
            };

            var currentUserId = (int)Membership.GetUser().ProviderUserKey;

            if(db.User_Subscribers.Contains(us))
            {
                ViewBag.Message = "You were already following this user.";
                ViewBag.Color = "Red";
                return View("Result");
            }

            db.User_Subscribers.InsertOnSubmit(us);
            db.SubmitChanges();

            var userName = (from userprofiles in userDb.UserProfiles
                            where userprofiles.UserId == currentUserId
                                 select userprofiles.UserName).FirstOrDefault();

            CookbookController.SendSMS(userId, userName + " has subscribed to your blog. Come greet your new subscriber at The Cookbook!");
            CookbookController.SendEmail(userId, userName + " has subscribed to your blog.", userName + " has subscribed to your blog. Come greet your new subscriber at The Cookbook!");

            ViewBag.Message = "Successfully Subscribed!";
            ViewBag.Color = "Green";

            return View("Result");
        }
 partial void DeleteUser_Subscriber(User_Subscriber instance);
 partial void UpdateUser_Subscriber(User_Subscriber instance);
 partial void InsertUser_Subscriber(User_Subscriber instance);
        /// <summary>
        /// View another user's cookbook
        /// </summary>
        /// <param name="userId">The user you're looking at</param>
        /// <param name="page">Current page number</param>
        /// <returns></returns>
        public ActionResult ViewCookbook(int userId, Nullable<int> page)
        {
            try
            {
                //if the user id is the logged in user's, redirect to index
                if (userId == (int)Membership.GetUser().ProviderUserKey)
                {
                    return RedirectToAction("Index");
                }

                User_Subscriber us = new User_Subscriber
                {
                    UserId = (int)Membership.GetUser().ProviderUserKey,
                    SubscriberId = userId
                };

                if (db.User_Subscribers.Contains(us))
                {
                    ViewBag.IsSubscribed = true;
                }
                else
                {
                    ViewBag.IsSubscribed = false;
                }

                ViewBag.UserId = userId;
                ViewBag.Username = (from allUsers in userDb.UserProfiles
                                    where allUsers.UserId == userId
                                    select allUsers.UserName).First();

                if (page == null || page < 1)
                    page = 1;
                var sortedPosts = GetCombinedPosts(GetRecipes(userId), GetBlogPosts(userId), (int)page, ViewBag);

                return View(sortedPosts);
            }
            catch (InvalidOperationException e)
            {
                ViewBag.Error = "Error retrieving user profile";
                return View("Error");
            }
        }
        /// <summary>
        /// Removes a user from logged in user's subscriptions.
        /// </summary>
        /// <param name="userId">The subscription to remove</param>
        /// <returns>The result page</returns>
        public ActionResult RemoveSubscriber(int userId)
        {
            User_Subscriber us = new User_Subscriber
            {
                UserId = (int)Membership.GetUser().ProviderUserKey,
                SubscriberId = userId
            };

            if (!db.User_Subscribers.Contains(us))
            {
                ViewBag.Message = "You weren't following this user.";
                ViewBag.Color = "Red";
                return View("Result");
            }

            db.ExecuteQuery<Object>("DELETE FROM User_Subscriber " +
                                    "WHERE UserId=" + us.UserId +
                                    " AND SubscriberId=" + userId);

            db.SubmitChanges();

            ViewBag.Message = "Successfully Unsubscribed!";
            ViewBag.Color = "Green";
            return View("Result");
        }