public JsonResult GetSynchronizationInfo() { if (Session["batchId"] == null) { Session.Remove("synchronization"); return(Json(new { completed = true, info = string.Empty }, JsonRequestBehavior.AllowGet)); } var batchInfo = tasks.Task.Run(() => _mailChimpManager.GetBatchInfo(Session["batchId"].ToString())).Result; //batch completed if (batchInfo.Item1) { Session.Remove("batchId"); Session.Remove("synchronization"); } return(Json(new { completed = batchInfo.Item1, info = batchInfo.Item2 }, JsonRequestBehavior.AllowGet)); }