Removed Link dependency from SpaceState

Moved a big block of code from SpaceState to LinkUtils, which was the
only place it was being used.