private RegistratorModel InitializeInternal(CodeType baseCodeType) { RegistratorModel result = null; if (BaseCodeType.ChildrenCodeTypeId == baseCodeType.Id) { if (Child == null) { Child = new RegistratorModel(); Child.Initizlie(baseCodeType); Child.Parent = this; } result = Child; } else if (BaseCodeType.Id == baseCodeType.ChildrenCodeTypeId) { if (Parent == null) { Parent = new RegistratorModel(); Parent.Initizlie(baseCodeType); Parent.Child = this; } result = Parent; } else { if (Child != null) { result = Child.InitializeInternal(baseCodeType); } if (result == null && Parent != null) { result = Parent.InitializeInternal(baseCodeType); } } return(result); }