Sort relation suggestions most recent first

Solves #1918. Sort the relations by id. Also some extra code to handle unsaved relations so that they appear before all others, and again with newer-created ones first. Once again, not a very testable bit of the codebase but I'm happy to add one if you suggest an approach.