public IHttpActionResult GetMyLeads(string EmpId, string clientId, int?departmentId, string taskType, string status, int?page, int?count, string sortCol, string sortDir)
 {
     try
     {
         using (MaxMasterDbEntities db = new MaxMasterDbEntities())
         {
             int totalRecords = 0;
             var leads        = db.GetToDoLeads(EmpId, clientId, departmentId, taskType, status, page, count, sortCol, sortDir).ToList();
             if (leads.Count > 0)
             {
                 totalRecords = (int)leads.FirstOrDefault().TotalCount;
             }
             return(Content(HttpStatusCode.OK, new { leads, totalRecords }));
         }
     }
     catch (Exception ex)
     {
         new Error().logAPIError(System.Reflection.MethodBase.GetCurrentMethod().Name, ex.ToString(), ex.StackTrace);
         return(Content(HttpStatusCode.InternalServerError, "An error occured, please try again later"));
     }
 }