/// <summary>
        /// Reports logic
        /// </summary>
        /// <returns></returns>
        public ActionResult OperatorReport()
        {
            var productivityReport = new OperatorReportItems
            {
                OperatorProductivity = new List <OperatorReportViewModel>()
            };

            ViewBag.Message = "Operator Productivity Report";

            productivityReport.OperatorProductivity = _repository.GetReports(new ReportFilter()).Select(r => new OperatorReportViewModel
            {
                ID = r.Id,
                AverageChatLength = !string.IsNullOrEmpty(r.AverageChatLength) ? $"{r.AverageChatLength}m" : "-",
                Name = r.Name,
                ProactiveAnswered     = r.ProactiveAnswered,
                ProactiveResponseRate = r.ProactiveResponseRate,
                ProactiveSent         = r.ProactiveSent,
                ReactiveAnswered      = r.ReactiveAnswered,
                ReactiveReceived      = r.ReactiveReceived,
                ReactiveResponseRate  = r.ReactiveResponseRate,
                TotalChatLength       = _durationParser.Parse(r.TotalChatLength)
            }).ToList();

            return(View(productivityReport));
        }
        public IEnumerable <OperatorReportViewModel> GetReports(string sw = null, string sd = null, string from = null, string to = null, string sdate = null)
        {
            //TODO: roll in ORM like EF or Dapper for Db access
            var result = _repository.GetReports(_paramsParser.Parse(sw, sd, from, to, sdate)).Select(r => new OperatorReportViewModel
            {
                ID = r.Id,
                AverageChatLength = !string.IsNullOrEmpty(r.AverageChatLength)? $"{r.AverageChatLength}m":"0",
                Name = r.Name,
                ProactiveAnswered     = r.ProactiveAnswered,
                ProactiveResponseRate = r.ProactiveResponseRate,
                ProactiveSent         = r.ProactiveSent,
                ReactiveAnswered      = r.ReactiveAnswered,
                ReactiveReceived      = r.ReactiveReceived,
                ReactiveResponseRate  = r.ReactiveResponseRate,
                TotalChatLength       = _durationParser.Parse(r.TotalChatLength)
            }).ToList();

            return(result);
        }