Extract ModelGraph from SyncManager.

Moving the ModelGraph class into the light so that it could be tested.