public int savePreferences(PreferencesObject pref) {

        // Declare variable
        int count = 0;
        int rvalue;
        int user_id = -1;
        String user_first_name = "";
        String user_password = "";

        // Declare query statement
        String query = "SELECT * FROM tracare_preferences WHERE userid = ?";
        try {

            // Create the prepared statement and fill in the values
            PreparedStatement pstmt = conn.prepareStatement(query);
            pstmt.setInt(1, pref.getUserID());

            // Execute the statement
            ResultSet rs = pstmt.executeQuery();
            ResultSetMetaData rsmd = rs.getMetaData();
            
            while (rs.next()) {
                count++;
            }

            // Check to see if the preferences entry does not exist
            if (count == 0) {
                
                // Create the insert query
                query = "INSERT INTO tracare_preferences (userid, track_weight, track_sleep, track_blood_pressure, track_energy_level, track_quality_of_sleep, track_fitness, track_nutrition, track_symptom, track_location) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
                
                try {
                    
                    // Create the prepared statement and fill in the values
                    PreparedStatement pstmtInsert = conn.prepareStatement(query);
                    pstmtInsert.setInt(1, pref.getUserID());
                    pstmtInsert.setBoolean(2, pref.isTrackWeight());
                    pstmtInsert.setBoolean(3, pref.isTrackSleep());
                    pstmtInsert.setBoolean(4, pref.isTrackBloodPressure());
                    pstmtInsert.setBoolean(5, pref.isTrackEnergyLevel());
                    pstmtInsert.setBoolean(6, pref.isTrackQualityofSleep());
                    pstmtInsert.setBoolean(7, pref.isTrackFitness());
                    pstmtInsert.setBoolean(8, pref.isTrackNutrition());
                    pstmtInsert.setBoolean(9, pref.isTrackSymptom());
                    pstmtInsert.setBoolean(10, pref.isTrackLocation());
                    
                    // Execute the statement
                    rvalue = pstmtInsert.executeUpdate();
                } catch (SQLException ex) {
                    rvalue = -3;
                }
            } else {
                
                // Create the update query
                query = "UPDATE tracare_preferences SET track_weight = ?, track_sleep = ?, track_blood_pressure = ?, track_energy_level = ?, track_quality_of_sleep = ?, track_fitness = ?, track_nutrition = ?, track_symptom = ?, track_location = ? WHERE userid = ?";
                
                try {
                    
                    // Create the prepared statement and fill in the values
                    PreparedStatement pstmtUpdate = conn.prepareStatement(query);
                    
                    pstmtUpdate.setBoolean(1, pref.isTrackWeight());
                    pstmtUpdate.setBoolean(2, pref.isTrackSleep());
                    pstmtUpdate.setBoolean(3, pref.isTrackBloodPressure());
                    pstmtUpdate.setBoolean(4, pref.isTrackEnergyLevel());
                    pstmtUpdate.setBoolean(5, pref.isTrackQualityofSleep());
                    pstmtUpdate.setBoolean(6, pref.isTrackFitness());
                    pstmtUpdate.setBoolean(7, pref.isTrackNutrition());
                    pstmtUpdate.setBoolean(8, pref.isTrackSymptom());
                    pstmtUpdate.setBoolean(9, pref.isTrackLocation());
                    pstmtUpdate.setInt(10, pref.getUserID());
                    
                    // Execute the statement
                    rvalue = pstmtUpdate.executeUpdate();
                } catch (SQLException ex) {
                    rvalue = -2;
                }
            }
        } catch (SQLException ex) {
            rvalue = -2;
        }

        // Return the result
        return rvalue;
    }