Adding a generic topological sort for the update pipeline.

I think if we're going to make this change now then we need to also make the change to avoid setting the key properties (or any read-only property) as modified when the entity is marked as modified. Otherwise any code that sets the state to Modified (or uses the Update method) will throw in the update pipeline. I believe Music Store does this, for example.