void checkIfParentRelated(Salesman child) { if (child.ParentSalesmanId.IsNullOrWhiteSpace()) { return; } if (child.ParentSalesman.IsNull()) { child.ParentSalesman = Find(child.ParentSalesmanId); } child.ParentSalesman.IsNullThrowException(); stackOfAncestors.Push(child); if (isExpectedParentRelatedToChild(child.ParentSalesman, child)) { string err = string.Format("'{0}' and '{1}' are already related. {2}", child.ParentSalesman.FullName(), child.FullName(), listAncestors()); throw new Exception(err); } }