Obtain permanent IDs for objects with temporary IDs before retrieving from alternate context

This is the end of a long running thread starting with the problems reported (and fixed) by @tonymillion, and subsequently picked up by @NealErhardt in #379. 

This change will retrieve permanent IDs for any objects that don't have them prior to looking for them in an alternate context. It prevents a Cocoa error with the code 13300.