private object GetObject(TeamEmployeeDisplay Item, object CurrentObjectValue) { IList objects = CurrentObject.GetPropertyValue("TeamEmployees") as IList; //IList objects = _ObjectSpace.GetObjects(MemberInfo.ListElementTypeInfo.Type, new BinaryOperator(CurrentObject.GetType().Name, CurrentObjectValue), true); foreach (object obj in objects) { if (Item.Employee != null) { if (obj.GetPropertyValue("Employee") != null && (obj.GetPropertyValue("Employee") as Employee).Oid == Item.ID) { return(obj); } } else if (Item.Team != null) { if (obj.GetPropertyValue("Team") != null && (obj.GetPropertyValue("Team") as Team).Oid == Item.ID) { return(obj); } } } return(null); }