Speed up page reordering

`update_positions` and `update_child_positions` methods perform a lot of useless UPDATE queries. Pull request adds few checks to prevent this. Fixes #2702 and #2631 

Some benchmarking (315 pages, https://gist.github.com/vladimir-tikhonov/7aea6077be29c38ab6f7):
__Before:__
> Click 'Reorder Pages' and then immediately 'Done Reordering Pages': __21981.7ms__
> Click 'Reorder Pages', mix pages for 5 seconds and  'Done Reordering Pages': __21779.1ms__

__After:__
> Click 'Reorder Pages' and then immediately 'Done Reordering Pages': __644.8ms__
> Click 'Reorder Pages', mix pages for 5 seconds and  'Done Reordering Pages': __2878.9ms__