/**
  * Find an ID in the kill collections for name of type key
  *
  * @throws Kingboard_KillmailParser_KillmailErrorException
  * @param string $name
  * @param string $key
  * @return integer
  */
 protected function queryKillCollections($name, $key)
 {
     $keyName = $key . 'Name';
     $keyId = $key . 'ID';
     $result = Kingboard_Kill::findOne(array('$or' => array(array('victim.' . $keyName => $name), array('attackers.' . $keyName => $name))));
     if (!empty($kill['victim'][$keyId]) && $result['victim'][$keyName] == $name) {
         return (int) $kill['victim'][$keyId];
     } else {
         if (is_array($result['attackers'])) {
             foreach ($result['attackers'] as $attacker) {
                 if ($attacker[$keyName] == $name) {
                     return (int) $attacker[$keyId];
                 }
             }
         }
     }
     throw new Kingboard_KillmailParser_KillmailErrorException('No result for typeName ' . $name . ' in the kills collection');
 }