private <T extends Ticket> T read(final String id, final Class<T> clazz) {
   log.debug("Reading {}", id);
   final T ticket;
   try {
     final String context = context(clazz);
     final StorageRecord<T> record = storageService.read(context, id);
     if (record == null) {
       log.debug("{} not found in context {}", id, context);
       return null;
     }
     ticket = record.getValue(serializer(clazz), context, id);
   } catch (IOException e) {
     throw new RuntimeException("Error reading ticket.");
   }
   return ticket;
 }
 private <T extends Ticket> void store(final T ticket) {
   final String context = context(ticket.getClass());
   log.debug("Storing {} in context {}", ticket, context);
   try {
     if (!storageService.create(
         context,
         ticket.getId(),
         ticket,
         serializer(ticket.getClass()),
         ticket.getExpirationInstant().getMillis())) {
       throw new RuntimeException("Failed to store ticket " + ticket);
     }
   } catch (IOException e) {
     throw new RuntimeException("Failed to store ticket " + ticket, e);
   }
 }