@SuppressWarnings("rawtypes")
	public void saveForecast() {

		String result = null;
		String weatherDescription = null;		

		try {			
			result = urlReader.readUrl("http://api.openweathermap.org/data/2.5/forecast/daily?lat=" + config.getWeather_lat() + "&lon=" + config.getWeather_lon() + "&cnt=" + config.getWeather_future_in_days() + "&mode=json&units=metric");

			JSONParser jsonParser = new JSONParser();
			JSONObject jsonObject = (JSONObject) jsonParser.parse(result);

			JSONArray list = (JSONArray) jsonObject.get("list");

			Iterator i = list.iterator();

			boolean dataIsPresent;
			if(qb.selectFrom("forecast").all().executeQuery().next()){
				dataIsPresent = true;
			} else {
				dataIsPresent = false;
			}

			int count = 1;

			while (i.hasNext()) {

				JSONObject innerObj = (JSONObject) i.next();

				Date date = new Date((Long) innerObj.get("dt") * 1000L);
				String string_date = date.toString();

				JSONObject temp = (JSONObject) innerObj.get("temp");
				double celsius = Double.parseDouble(temp.get("day").toString());
				String temperature = String.valueOf(celsius);

				JSONArray subList = (JSONArray) innerObj.get("weather");

				Iterator y = subList.iterator();

				while (y.hasNext()) {
					JSONObject childObj = (JSONObject) y.next();
					weatherDescription = (String) childObj.get("description");
				}

				String count_String = Integer.toString(count);

				String table = "forecast";
				String[] fields = {"forecastID", "day", "temperature", "summary"};
				String[] values = {count_String, string_date, temperature, weatherDescription};

				if(dataIsPresent){
					qb.update(table, fields, values).where("forecastID", "=", count_String).execute();
				} else {
					qb.insertInto(table, fields).values(values).execute();
				}
				count++;
			} 
		} catch (ParseException ex) {
			ex.printStackTrace();
		} catch (NullPointerException ex) {
			ex.printStackTrace();
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}