protected int getLastId() throws DaoException {
    if (dao.size() == 0) {
      return 0;
    }

    return ((TaskModel) dao.getAll().get(dao.size() - 1)).getId();
  }