public ActionResult EditPage(EditAccountViewModel model, HttpPostedFileBase file)
        {
            UsersService users = new UsersService();
            String currentUsername = User.Identity.Name;
            User user = (User)users.FindUserByUsername(currentUsername);

            if (user != null)
            {
                if (!currentUsername.Equals(user.Username))
                {
                    return RedirectToAction("Index", "Home");
                }
            }

            User checkForMail = (User)users.FindUserByEmail(model.Email);
            if (checkForMail == null || checkForMail.Email.Equals(user.Email))
            {
                user.FirstName = model.FirstName;
                user.LastName = model.LastName;
                user.Email = model.Email;
                if (!model.removeImage)
                {
                    if (file != null)
                    {
                        using (MemoryStream ms = new MemoryStream())
                        {
                            file.InputStream.CopyTo(ms);
                            byte[] array = ms.GetBuffer();
                            if (array.Length > 55000)
                            {
                                ViewBag.Error = "Image size can't be more than ~50Kb!!";
                                return View(model);
                            }
                            user.ProfilePicture = array;
                        }
                    }
                }
                else
                {
                    user.ProfilePicture = null;
                }

                users.Edit(user);
                return RedirectToAction("Index", "Home");
            }
            else
            {
                ViewBag.Error = "Email address already exist!!";
                return View(model);
            }
        }
        /// <summary>
        /// Go to edit page for current Loged in user.
        /// </summary>
        public ActionResult EditPage(String id)
        {
            UsersService users = new UsersService();
            User user = (User)users.FindUserByUsername(id);
            String currentUsername = User.Identity.Name;
            if (user != null)
            {
                if (!currentUsername.Equals(user.Username))
                {
                    return RedirectToAction("Index", "Home");
                }

                EditAccountViewModel model = new EditAccountViewModel();
                model.Email = user.Email;
                model.FirstName = user.FirstName;
                model.LastName = user.LastName;
                model.removeImage = false;
                return View(model);
            }
            else
            {
                return View();
            }
        }