protected static function _move_tour(tour $tour, $direction) {
        $currentsortorder   = $tour->get_sortorder();
        $targetsortorder    = $currentsortorder + $direction;

        $swapwith = helper::get_tour_from_sortorder($targetsortorder);

        // Set the sort order to something out of the way.
        $tour->set_sortorder(-1);
        $tour->persist();

        // Swap the two sort orders.
        $swapwith->set_sortorder($currentsortorder);
        $swapwith->persist();

        $tour->set_sortorder($targetsortorder);
        $tour->persist();
    }