/**
  *   adjust_registration_quantities
  * will either add registrations for NEW tickets
  * or adjust quantities for existing tickets
  *
  * @access protected
  * @param \EE_Transaction $transaction
  * @param int $TKT_ID
  * @param array $ticket_line_items
  * @param array $reg_tickets
  * @return bool
  */
 protected static function adjust_registration_quantities(EE_Transaction $transaction, $TKT_ID = 0, $ticket_line_items = array(), $reg_tickets = array())
 {
     $changes = false;
     // are there any corresponding registrations for this ticket?
     if (isset($reg_tickets[$TKT_ID])) {
         // corresponding registrations exist, so let's compare counts...
         $tkt_count = count($ticket_line_items);
         $reg_count = count($reg_tickets[$TKT_ID]);
         if ($tkt_count > $reg_count) {
             // ticket(s) added = create registrations
             for ($x = 0; $x < $tkt_count - $reg_count; $x++) {
                 $changes = EED_Multi_Event_Registration::add_registration($ticket_line_items[$x], $transaction) ? true : $changes;
             }
         } else {
             if ($tkt_count < $reg_count) {
                 // ticket(s) removed = remove registrations
                 for ($x = $reg_count; $x > $tkt_count; $x--) {
                     // grab last registration that corresponds to this ticket type
                     $registration = array_pop($reg_tickets[$TKT_ID]);
                     $changes = EED_Multi_Event_Registration::remove_registration($transaction, $registration) ? true : $changes;
                 }
             } else {
                 // tickets match registrations = no change
                 return false;
             }
         }
     } else {
         // no corresponding registrations????
         // we need to create registrations for these tickets
         $reg_count = 0;
         foreach ($ticket_line_items as $ticket_line_item) {
             $reg_count++;
             $changes = EED_Multi_Event_Registration::add_registration($ticket_line_item, $transaction) ? true : $changes;
         }
     }
     return $changes;
 }