public ActionResult Authenticate(LoginViewModel model)
        {
            try
            {
                _UserDetailsBusinessLogic = new UserDetailsBusinessLogic();
                int userId = 0;
                if (LoginAuth(model.Username, model.Password))
                {
                    if (_UserDetailsBusinessLogic.IsUserActive(model.Username) == true)
                    {
                        //Before redirecting:
                        // 1.Add the session details to UserSessionLog
                        // 2.Update the 'IsLoggedIn' flsg of SystemUser as true
                        userId = _UserDetailsBusinessLogic.GetUserID(model.Username);
                        _UserDetailsBusinessLogic.SaveSessionDetails(userId, IPAddress, countryCode, country, city, region);
                        _UserDetailsBusinessLogic.UpdateLoggedInStatus(userId, true);


                        if (userMsgRequestId != null)
                        {
                            return(RedirectToAction("Index", "UserMessage", new RouteValueDictionary(new { requestId = userMsgRequestId })));
                        }

                        return(RedirectToAction("Index", "LandingPage"));
                    }
                    else
                    {
                        TempData["notice"] = "Oops..Your account has been inactivated temporarily.Please contact the System Administrator";
                        return(RedirectToAction("Index", "Login"));
                    }
                }
                else
                {
                    this.HttpContext.Session["ErrorMsg"] = "LoginErr";
                    TempData["notice"] = "Username Pasword Combination  Is Incorrect";
                    return(RedirectToAction("Index", "Login"));
                }
            }
            catch (Exception ex)
            {
                currentFile = this.ControllerContext.RouteData.Values["controller"].ToString(); // System.Diagnostics.StackTrace(true).GetFrame(0).GetFileName();
                StackTrace st = new StackTrace();
                StackFrame sf = st.GetFrame(0);
                methodName = sf.GetMethod().Name;
                ErrorLogHelper.UpdatingErrorLog(currentFile + "-" + methodName, "N/A", ex);

                return(RedirectToAction("Index", "Login"));
            }
        }