protected function loadPreviousObject($type, $sortkeyName, $sortkeyValue, $sortDirection) {
    $query = new ObjectQuery($type);
    $tpl = $query->getObjectTemplate($type);
    $tpl->setValue($sortkeyName, Criteria::asValue($sortDirection == 'ASC' ? '<' : '>', $sortkeyValue), true);
    $pagingInfo = new PagingInfo(1, true);
    $objects = $query->execute(BuildDepth::SINGLE, [$sortkeyName." ".($sortDirection == 'ASC' ? 'DESC' : 'ASC')], $pagingInfo);
    return sizeof($objects) > 0 ? $objects[0] : null;
  }