Massive cleanup to the ResolveIdentities operation to add checks.

* This should hopefully handle all the nasty exception handling operations
  that the old version did with a loop.
* The error messages probably need better detail.