Adding a generic topological sort for the update pipeline.

I wonder if these methods should be collapsed/consolidated, possibly with an enum for the value source--current value, original value, or fk snapshot.