extract reordering logic from jackalope into phpcr-utils

this allows us to reuse it in phpcr-odm too