private Object performRecordingAndReplaying(Object request, InvocationContext ctx) {
   Object response;
   try {
     response = performReplaying(request, ctx, true);
   } catch (ResultNotFoundException e) {
     response = proceed(ctx);
     storageCollection.add(request, response, ctx);
   }
   return response;
 }
 private Object performReplaying(
     Object request, InvocationContext ctx, boolean throwExceptionOnNotFound) {
   Object response;
   try {
     response = storageCollection.get(request, ctx);
   } catch (ResultNotFoundException e) {
     if (throwExceptionOnNotFound) {
       throw e;
     } else {
       response = proceed(ctx);
     }
   }
   return response;
 }
 private Object performRecording(Object request, InvocationContext ctx) {
   Object response = proceed(ctx);
   storageCollection.add(request, response, ctx);
   return response;
 }