public Wizard GetWizard(WizardRequest request) { if (request == null) { return(null); } var query = _planningRepository.FindBy <Wizard>(w => w.PlanningWizardID == request.PlanningWizardID); if (request.IncludePhases) { query = query.Include("Phases") .Include("Phases.Steps") .Include("Phases.Steps.ActionItems"); } return(query.FirstOrDefault()); }