Move more of identity change detection into an easily testable class.