public static function compare_by_title(QTIAssessmentItem $a, QTIAssessmentItem $b)
 {
     // get titles
     $ta = $a->data("title");
     $tb = $b->data("title");
     // if both lack titles compare by ID
     if ($ta === false && $tb === false) {
         return strcasecmp($a->getQTIID(), $b->getQTIID());
     }
     // if A lacks a title B is further up the list and so A is "more"
     if ($ta === false) {
         return 1;
     }
     // if B lacks a title A is further up the list and so A is "less"
     if ($tb === false) {
         return -1;
     }
     return strcasecmp($ta, $tb);
 }