public static void index() {
   if (Gallery.count() > 0) {
     Gallery defaultGallery = Gallery.all().first();
     showGallery(defaultGallery.id, defaultGallery.name);
   } else {
     render();
   }
 }
  public static void showGallery(Long id, String name) {
    notFoundIfNull(id);
    Gallery gallery = Gallery.findById(id);
    notFoundIfNull(gallery);

    List<Picture> pictures = gallery.getPictures();
    List<ImageView> images = new ArrayList<ImageView>();
    for (Picture picture : pictures) images.add(picture.toImageView());

    render("Application/gallery.html", images, gallery);
  }
 @Util
 public static List<Gallery> getGalleries() {
   return Gallery.all().fetch();
 }