public ActionResult Index(string companyId, string userId)
        {
            Log.Add("Impersonate Logging in with companyId=" + (companyId ?? "") + ", userId=" + (userId ?? ""));

            var formsAuthenticationService = new FormsAuthenticationService();
            formsAuthenticationService.SignOut();

            var impersonateSettings = CreateImpersonateGuardSettings();
            var allowedToImpersonate= new ImpersonateGuard(impersonateSettings).IsAllowed(Request.UrlReferrer);
            if (allowedToImpersonate == false)
                return null;

            AddCookieToShowWeAreInImpersonateMode();

            var formsauthenticationService = new FormsAuthenticationService();
            formsauthenticationService.SignIn(userId, true, companyId.ToString(CultureInfo.InvariantCulture));

            new CacheHelper().RemoveUser(Guid.Parse(userId));

            Log.Add("Impersonate Logged in.");
            
            // Hack for general user testing because not got home page for this user
            // This gapping hole has to change anyway 
            if (userId == "E7385B71-ABFC-400A-8FB0-CC58ACA78E38")
            {
                return RedirectToAction("Index", "Company", new { id = companyId, area = "Company" });    
            }

            return RedirectToAction("Index", "TaskList", new { area = "TaskList" });
        }
 private static void SignOutFromFormsAuthentication()
 {
     var formsAuthenticationService = new FormsAuthenticationService();
     formsAuthenticationService.SignOut();
 }