private static CelestialObject GetParent(IIdResolver resolver, IObject satellite, ObjectReference? orbits) { CelestialObject parent; if (resolver.TryGet(orbits, out parent)) { return parent; } throw new InvalidOperationException(string.Format("{0} is not orbiting anything", satellite.AsObjectReference())); }