public void insertEvent() {
        PreparedStatement st = null;
        ResultSet rs = null;
        String q = "INSERT INTO events SET name = ?, location = ?, start_date = ?, end_date = ?";
        try {
            java.sql.Date sd = null;
            java.sql.Date ed = null;
            if (this.startDate != null) {
                sd = new java.sql.Date(StringUtil.stringToDate(startDate).getTime());
            }
            if (this.endDate != null) {
                ed = new java.sql.Date(StringUtil.stringToDate(endDate).getTime());
            }
            conn = dbconn.getConnection();
            st = conn.prepareStatement(q, PreparedStatement.RETURN_GENERATED_KEYS);
            st.setString(1, this.name);
            st.setString(2, this.location);
            st.setDate(3, sd);
            st.setDate(4, ed);
            st.executeUpdate();
            rs = st.getGeneratedKeys();
            if (rs.next()) {
                setId(rs.getInt(1));
            }
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            try {
                conn.close();
                st.close();
                rs.close();
            } catch (SQLException e) {
                System.out.println("Unable to close connection");
            }
        }
    }