public void TrySwapToGrid(Atom fromAtom, SubGrid targetSubGrid) { var droppingToAtom = targetSubGrid.currentAtom; var originalSubGrid = fromAtom.subGrid; droppingToAtom?.SubGridUnlink(targetSubGrid); targetSubGrid.AtomUnlink(droppingToAtom); originalSubGrid.AtomUnlink(fromAtom); fromAtom.SubGridUnlink(originalSubGrid); targetSubGrid.AtomLinked(fromAtom); fromAtom.SubGridLinked(targetSubGrid); originalSubGrid.AtomLinked(droppingToAtom); droppingToAtom?.SubGridLinked(originalSubGrid); }