/// <summary> /// Bind a Summary to this Case. /// </summary> public void BindSummary(Summary summary) { // There is Nothing to Do. Summary already belongs to this Case. if (summary.CaseId == Id) { return; } #region Incident Rule // For now a Case may only have 1 Incident Summary (In the future this may change to allow multiple incidents per Case) var incidentSummary = summary as IncidentSummary; if (incidentSummary != null && PrimaryIncident != null) { throw new Exception("This Case Already has a Primary Incident Summary."); } #endregion // Make Sure the Summary Is Bound to this Case if (summary.CaseId != Id) { summary.BindToCase(this); } // Make Sure the Summary belongs to this Case. if (!Summaries.Any(x => x.Id == summary.Id)) { SummaryCollection.Add(summary); } }