private int insertIntoTableValuesForFields(String table, String fields, Object... values) {
        String insert = "";
        PreparedStatement statement = null;
        Statement getIDGenerated = null;
        ResultSet generatedID = null;

        int idGene = -1;
        try {
            //Statement s = this.connexion.createStatement();

            //create the query
            insert = "INSERT INTO " + table.toUpperCase() + fields + " values(";

            for (int i = 0; i < values.length; i++) {
                insert += (values[i] instanceof String ? "'" : "")
                        + values[i]
                        + (values[i] instanceof String ? "'" : "")
                        + (i == values.length - 1 ? "" : ",");
            }

            insert += ")";

            System.out.println(insert);

            statement = this.connexion.prepareStatement(insert, Statement.RETURN_GENERATED_KEYS);

            int affectedRows = statement.executeUpdate();
            if (affectedRows == 0) {
                System.out.println("ERROR : NO ROW AFFECTED");
            }

            //GET THE LAST ID GENERERATED
            getIDGenerated = this.connexion.createStatement();
            insert = "SELECT MAX(id" + table.substring(0, 1).toUpperCase() + table.substring(1).toLowerCase() + ") FROM " + table.toUpperCase() + "";

            generatedID = getIDGenerated.executeQuery(insert);
            while (generatedID.next()) {
                idGene = generatedID.getInt(1);
            }

            statement.closeOnCompletion();
            return idGene;

            //TODO: Find a better way to get back the generated ID...
//            System.out.println("UpdateCount : " + statement.getUpdateCount());
//            generatedKeys = statement.getGeneratedKeys();
//            System.out.println("KEY GENERATED");
//            int c = 0;
//            while (generatedKeys.next()) {
//                c++;
//                //idGenerated = (int)generatedKeys.getInt(1);
//                System.out.println("ID GENERATED : " + generatedKeys.getLong(c));
//            }
////            else {
////                System.out.println("ERROR : NO ID GENERATED");
////            }
        } catch (SQLException ex) {
            System.out.println("ERROR ON : " + insert);
            System.out.println(ex);
            return -1;
        }
    }