protected IQueryable<EnhancedStudentInformation> GetStudentSectionEntityListData(StudentListType studentListType)
        {
            switch (studentListType)
            {
                case StudentListType.Section:
                    return (from ts in GetSuppliedTeacherStudentSection()
                            join sl in GetSuppliedStudentList()
                                on ts.StudentUSI equals sl.StudentUSI
                            where ts.TeacherSectionId == suppliedSectionId && sl.SchoolId == suppliedSchoolId
                            select sl).ToList().AsQueryable();
                case StudentListType.Cohort:
                    return (from ssc in GetSuppliedStaffStudentCohort()
                            join sl in GetSuppliedStudentList()
                            on ssc.StudentUSI equals sl.StudentUSI
                            where ssc.StaffCohortId == suppliedSectionId && sl.SchoolId == suppliedSchoolId
                            select sl).ToList().AsQueryable();
                case StudentListType.CustomStudentList:
                    //need to break up this function because the tables are from 2 different DBs (App & LEA)
                    long[] studentUSIs = GetSuppliedStaffCustomStudentListStudent().Where(x => x.StaffCustomStudentListId == suppliedSectionId).Select(x => x.StudentUSI).ToArray();

                    if (studentUSIs.Length == 0)
                        return new List<EnhancedStudentInformation>().AsQueryable();

                    return (from sl in GetSuppliedStudentList()
                            where studentUSIs.Contains(sl.StudentUSI) && sl.SchoolId == suppliedSchoolId
                            select sl).ToList().AsQueryable();
                default:
                    var sectionStudentIds = (from tss in GetSuppliedTeacherStudentSection().Distinct()
                                             join ts in GetSuppliedTeacherSection() on tss.TeacherSectionId equals ts.TeacherSectionId
                                                 where ts.StaffUSI == suppliedStaffUSI && ts.SchoolId == suppliedSchoolId
                                                 group tss by tss.StudentUSI
                                                     into g
                                                     select g.Key).ToList();

                    var cohortStudentIds = (from ssc in GetSuppliedStaffStudentCohort().Distinct()
                                            join sc in GetSuppliedStaffCohort() on ssc.StaffCohortId equals sc.StaffCohortId
                                                where sc.StaffUSI == suppliedStaffUSI && sc.EducationOrganizationId == suppliedSchoolId
                                                group ssc by ssc.StudentUSI
                                                    into h
                                                    select h.Key).ToList();

                    var customStudentListStudentIds = (from csl in GetSuppliedStaffCustomStudentList()
                                                           join csls in GetSuppliedStaffCustomStudentListStudent() on csl.StaffCustomStudentListId equals csls.StaffCustomStudentListId
                                                           where csl.StaffUSI == suppliedStaffUSI && csl.EducationOrganizationId == suppliedSchoolId
                                                           group csls by csls.StudentUSI
                                                           into h
                                                           select h.Key).ToList();

                    var studentIds = sectionStudentIds.Concat(cohortStudentIds).Concat(customStudentListStudentIds).Distinct().ToArray();

                    if (studentIds.Length == 0)
                        return null;

                    return (from sl in GetSuppliedStudentList()
                            where studentIds.Contains(sl.StudentUSI) && sl.SchoolId == suppliedSchoolId
                            select sl).ToList().AsQueryable();
            }
        }
        protected StudentMetricsProviderQueryOptions GetStudentListWithMetricsQueryOptions(StudentListType studentListType)
        {
            var suppliedStudentUSIs = new List<long>();
            var suppliedStaffUsi = 0;

            var queryOptions = new StudentMetricsProviderQueryOptions
            {
                SchoolId = suppliedSchoolId,
                StaffUSI = suppliedStaffUsi,
                StudentIds = suppliedStudentUSIs
            };

            switch (studentListType)
            {
                case StudentListType.Section:
                    queryOptions.TeacherSectionIds = new[]
                    {
                        (long)suppliedSectionId
                    };

                    break;
                case StudentListType.Cohort:
                    queryOptions.StaffCohortIds = new[]
                    {
                        (long)suppliedSectionId
                    };

                    break;
            }

            return queryOptions;
        }