@Override
  public void update(int id, String name, String biography, String photo) {
    String set = "name = ?, biography = ?, photo = ? ";
    String where = "id = ? ";
    List<Object> param = Arrays.asList(name, biography, photo, id);

    try {
      ConnectionManager.begin();
      dao.update(set, where, param);
      ConnectionManager.commit();
    } catch (SQLException e) {
      try {
        ConnectionManager.rollback();
      } catch (SQLException e1) {
        e1.printStackTrace();
      }

      throw new BookAppException(e.getMessage(), false);
    }
  }
  @Override
  public void add(Author a) {

    if (a.getName() == null || a.getName().isEmpty()) {
      throw new BookAppException("Author's name must be entered!", true);
    }

    try {
      ConnectionManager.begin();
      dao.insert(a);
      ConnectionManager.commit();
    } catch (SQLException e) {
      try {
        ConnectionManager.rollback();
      } catch (SQLException e1) {
        e1.printStackTrace();
      }
      throw new BookAppException(e.getMessage(), false);
    }
  }