public function moveItem(Model $model, $direct = null, $id = null, $delta = 1) {
		$direct = mb_strtolower($direct);
		$delta = (int)$delta;
		if (in_array($direct, ['up', 'down']) && ($delta < 0)) {
			throw new InternalErrorException(__d('view_extension', 'Invalid delta for moving record'));
		}

		if (!in_array($direct, ['top', 'up', 'down', 'bottom'])) {
			throw new InternalErrorException(__d('view_extension', 'Invalid direction for moving record'));
		}

		switch ($direct) {
			case 'top':
				$delta = true;
				// no break
			case 'up':
				$method = 'moveUp';
				break;
			case 'bottom':
				$delta = true;
				// no break
			case 'down':
				$method = 'moveDown';
				break;
		}

		$newParentId = null;
		$optionsEvent = compact('id', 'newParentId', 'method', 'delta');
		$event = new CakeEvent('Model.beforeUpdateTree', $model, [$optionsEvent]);
		$model->getEventManager()->dispatch($event);
		if ($event->isStopped()) {
			return false;
		}

		$result = $model->$method($id, $delta);
		if ($result) {
			$event = new CakeEvent('Model.afterUpdateTree', $model);
			$model->getEventManager()->dispatch($event);
		}

		return $result;
	}