public ActionResult CreateReportFilter(long reportId) { var report = _reportRepository.GetById(reportId); var maxDisplayOrder = report.ReportFilters.Max(p => p.DisplayOrder) ?? 0; var reportFilter = new ReportFilter { ReportId = reportId, IsNew = true, DisplayOrder = maxDisplayOrder + 1 }; _reportFilterRepository.InsertAndCommit(reportFilter); var model = new ReportFilterModel(); model = reportFilter.ToModel(); var html = this.ReportFilterPanel(model); return(Json(new { Id = reportFilter.Id, Html = html })); }