//
 // GET: /Admin/UserStatistics/
 public ActionResult Index()
 {
     CurrentPage = PageTypes.Find;
     var model = new UserStatVm();
     model.ApplyFilters();
     model.FilteredItems = new List<User>();
     return View("Table", model);
 }
        public FileStreamResult Batch()
        {
            StringBuilder csvData = new StringBuilder();

            CurrentPage = PageTypes.Find;
            var model = new UserStatVm();
            model.ApplyFilters();
            model.FilteredItems = new List<User>();
            foreach (var item in model.Filters[0].FilterItems.OrderBy(o => o.ValueText))
            {
                csvData.AppendLine(string.Format("{0},{1}", item.ValueText, item.Count));
            }
            var byteArray = Encoding.ASCII.GetBytes(csvData.ToString());
            var stream = new MemoryStream(byteArray);
            return File(stream, "text/plain", "NITCAA_BatchStat_"+ DateTime.Now.ToString("MMM_dd")+".csv");
        }