adjust reordering logic, extract algorithm into phpcr-utils

this is to be coordianted with https://github.com/phpcr/phpcr-utils/pull/39 and a BC break for the transports.