public static function NuevoAval($avales, $id_cliente)
 {
     //avales debe ser un arreglo
     if (!is_array($avales)) {
         throw new InvalidDataException("Avales debe ser un array");
     }
     foreach ($avales as $a) {
         if (!is_array($a)) {
             $a = object_to_array($a);
         }
         if (!isset($a["id_aval"])) {
             throw new InvalidDataException("avales debe ser un arreglo de arreglos, falta id_aval");
         }
         if (!isset($a["tipo_aval"])) {
             throw new InvalidDataException("avales debe ser un arreglo de arreglos falta tipo_aval");
         }
         //tipos
         //if($a["tipo_aval"])
         if (is_null($a["id_aval"])) {
             throw new InvalidDataException("el aval " . $a["id_aval"] . "no existe");
         }
     }
     //validar que existan clientes y avales
     if (is_null($id_cliente)) {
         throw new InvalidDataException("el cliente a avalar no existe");
     }
     foreach ($avales as $a) {
         if (!is_array($a)) {
             $a = object_to_array($a);
         }
         if ($a["id_aval"] == $id_cliente) {
             //no se puede ser aval de sí mismo
             continue;
         }
         $clienteAval = new ClienteAval();
         $clienteAval->setIdAval($a["id_aval"]);
         $clienteAval->setIdCliente($id_cliente);
         $clienteAval->setTipoAval($a["tipo_aval"]);
         try {
             Logger::log("Salvando nuevo aval a DB");
             ClienteAvalDAO::save($clienteAval);
         } catch (Exception $e) {
             throw new InvalidDatabaseOperationException($e);
         }
     }
 }