// Returns the JSON Object representing the album having `id`.
 private void actionGetAlbum(Router router, Request request, String id) {
   for (JsonObject album : catalog.getValuesAs(JsonObject.class)) {
     if (album.getString("id").equals(id)) {
       router.sendJsonResponse(200, "OK", album);
       return;
     }
   }
   router.sendJsonError(404, "Not found");
 }
 // Update the existing album with `id`.
 //
 // Display the deleted album.
 private void actionDeleteAlbum(Router router, Request request, String id) {
   for (JsonObject oalbum : catalog.getValuesAs(JsonObject.class)) {
     if (oalbum.getString("id").equals(id)) {
       // TODO add model layer and data management
       router.sendJsonResponse(200, "OK", oalbum);
       return;
     }
   }
   // No album with this ID found, return error
   router.sendJsonError(404, "Not found");
 }
 // Update the existing album with `id`.
 //
 // Display the modified album.
 private void actionPutAlbum(Router router, Request request, String id) {
   JsonReader reader = Json.createReader(new StringReader(request.body));
   JsonObject album = reader.readObject();
   for (JsonObject oalbum : catalog.getValuesAs(JsonObject.class)) {
     if (oalbum.getString("id").equals(id)) {
       JsonObjectBuilder builder = Json.createObjectBuilder();
       for (String key : oalbum.keySet()) {
         builder.add(key, oalbum.get(key));
       }
       for (String key : album.keySet()) {
         builder.add(key, album.get(key));
       }
       // TODO add model layer and data management
       router.sendJsonResponse(200, "OK", builder.build());
       return;
     }
   }
   // No album with this ID found, return error
   router.sendJsonError(404, "Not found");
 }
 // Create a new album from a JsonRequest.
 //
 // Display the received album.
 private void actionPostAlbum(Router router, Request request, String id) {
   JsonReader reader = Json.createReader(new StringReader(request.body));
   JsonObject album = reader.readObject();
   // TODO add model layer and data management
   router.sendJsonResponse(201, "Created", album);
 }