private void InitializeReportMetadata(HeirarchicalTIRDetailModel model, TIRDetailReportParameter detailReportParameter)
        {
            base.SetNavigationLinksUrl();

            int decimalPlace = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["SiteDecimalPlace"].ToString());

            SiteUser su = ((SiteUser)Session["SiteUser"]);
            ModelServices service = new ModelServices();

            model.SchoolYear = service.SchoolYearDescriptionByYearId(detailReportParameter.Year);

            SetDetailReportUrlData(detailReportParameter);
            UpdateReportTemplateConfigurations(service, detailReportParameter.ReportTemplateId);
            ViewBag.SchoolTermList = service.GetSchoolTerms(detailReportParameter);

            var details = service.GetHeirarchicalDetailReport(su.Districts.First().Id, detailReportParameter);
            model.details = details;
            model.Subject = service.GetSubjectDescriptionById(detailReportParameter.Subject);
            model.SubjectId = detailReportParameter.Subject;
            model.SchoolYearId = detailReportParameter.Year;
            model.AssessmentTypeId = detailReportParameter.AssessmentTypeId;
            model.CameFromTitle = detailReportParameter.CameFromTitle;
            if (details.Count > 0)
            {
                model.AssessmentList = new List<AssessmentMEPerc>();
                var firstTirDetail = details[0];
                var schoolTermId = firstTirDetail.SchoolTermId;
                detailReportParameter.InputTermId = schoolTermId;
                foreach (var score in firstTirDetail.ScoreDataCollection)
                {
                    AssignMePercentForAssessment(score, service, su, detailReportParameter, ref model.AssessmentList);
                }

                service.IsChildAssessmentsExists(model.AssessmentList);

                List<int> studentCounts = studentCounts = new List<int>();
                List<decimal> impactSums = new List<decimal>();
                List<decimal> avgImpacts = new List<decimal>();
                List<int> countOfMeetOrExceed = new List<int>();

                for (int i = 0; i < model.details[0].ScoreDataCollection.Count; i++)
                {
                    studentCounts.Add(model.details.Count(d => d.ScoreDataCollection[i].Impact != null));
                    impactSums.Add(model.details.Sum(d => d.ScoreDataCollection[i].Impact.GetValueOrDefault()));
                    countOfMeetOrExceed.Add(model.details.Where(d => d.ScoreDataCollection[i].Impact >= -2).Count());
                    if (studentCounts[i] > 0)
                    {
                        avgImpacts.Add(Math.Round(impactSums[i] / studentCounts[i], decimalPlace));
                    }
                    else
                    {
                        avgImpacts.Add(0);
                    }
                }
                ViewBag.avgImpacts = avgImpacts;
            }
            var filterParameter = new FilterParameter
            {
                ClassId = detailReportParameter.ClassId,
                Teacher = detailReportParameter.Teacher,
                Year = detailReportParameter.Year,
                Race = detailReportParameter.Race,
                Gender = detailReportParameter.Gender,
                FrlIndicator = detailReportParameter.FrlIndicator,
                IEPIndicator = detailReportParameter.IEPIndicator,
                LEPIndicator = detailReportParameter.LEPIndicator,
                Hispanic = detailReportParameter.Hispanic,
                SchoolYear = model.SchoolYear
            };

            var reportFilterViewModel = ReportsFilterHelper.PopulateReportFilterViewModel(filterParameter, service, su);
            ViewBag.ReportFilters = reportFilterViewModel;
        }