public static function setSortorders($sort_data)
 {
     $stmt = Database::getInstance()->prepare("UPDATE `" . Util::classToTable(get_called_class()) . "` SET `sortorder` = ? WHERE `id` = ?");
     foreach ($sort_data as $id => $sortorder) {
         $stmt->execute(array($sortorder, $id));
     }
 }
 public function __construct($class_name, $verb, $callback)
 {
     if ($callback !== null && !is_callable($callback)) {
         throw new DatabaseException('ModelQueryBuilder: $callback should be callable, ' . gettype($callback) . ' given.');
     }
     $this->class_name = $class_name;
     $this->builder = QueryBuilder::$verb(Util::classToTable($class_name));
     if ($callback !== null) {
         $callback($this->builder);
     }
 }