var sectorEmployees = from ec in entities.EmployeeCategories.Where(x => x.Category_Id == 1 || x.Category_Id == 2 && x.Sector_Id == sectorId) join es in entities.EmployeeStatus.Where(x => x.EmployeeStatusType_Id == 1) on ec.Employee_Id equals es.Employee_Id select es;
var sectorEmployees = _service.GetEmployeeStatusBySector_Id(sectorId).OrderByDescending(x => x.EndDate).GroupBy(x => x.Employee_Id).Select(x => x.LastOrDefault()).ToList();