Fixes #358
Fixes #314. Reordering persistence: first writing edges to edge store and then doing index updates. Also, now making sure that each relation is only once passed to an index update.