/*
  * Save Artwork
  *
  * @param Object Artwork
  */
 public void save(Artwork artwork) {
   if (checkIsThere(artwork.getId()) != 0) {
     update(artwork);
   } else {
     add(artwork);
   }
 }
  /*
   * Update Artwork
   *
   * @param Object Artwork
   */
  private void update(Artwork artwork) {

    if (artwork.getGroupTitle() == null) {
      artwork.setGroupTitle("Unknow Title");
    }

    if (artwork.getThumbnailUrl() == null) {
      artwork.setThumbnailUrl(
          "http://torontoist.com/wp-content/uploads/2011/11/missing-art-640x479.jpg");
    }

    String sql = "UPDATE artwork SET title = ?, group_title = ?, thumbnail_url = ? WHERE id = ?";
    jdbcTemplate.update(
        sql,
        new Object[] {
          artwork.getTitle(), artwork.getGroupTitle(), artwork.getThumbnailUrl(), artwork.getId()
        });
  }
  /*
   * Add Artist
   *
   * @param Object Artwork
   */
  public void add(Artwork artwork) {

    if (artwork.getGroupTitle() == null) {
      artwork.setGroupTitle("Unknown Title ");
    }

    if (artwork.getThumbnailUrl() == null) {
      artwork.setThumbnailUrl(
          "http://torontoist.com/wp-content/uploads/2011/11/missing-art-640x479.jpg");
    }

    String sql = "INSERT INTO artwork (id, title, group_title,thumbnail_url) VALUES (?,?,?,?)";
    jdbcTemplate.update(
        sql,
        new Object[] {
          artwork.getId(), artwork.getTitle(), artwork.getGroupTitle(), artwork.getThumbnailUrl()
        });

    System.out.println("Artwork Saved");
  }