/**
  * Compare two items for ordered list
  *
  * @param Varien_Object $item1
  * @param Varien_Object $item2
  * @return int
  */
 public function compareItems($item1, $item2)
 {
     // Prevent rule-based items to have any position
     if (is_null($item2->getPosition()) && !is_null($item1->getPosition())) {
         return -1;
     } elseif (is_null($item1->getPosition()) && !is_null($item2->getPosition())) {
         return 1;
     }
     $positionDiff = (int) $item1->getPosition() - (int) $item2->getPosition();
     if ($positionDiff != 0) {
         return $positionDiff;
     }
     return (int) $item1->getEntityId() - (int) $item2->getEntityId();
 }