public static void insertCsvFileData(String location, Set<Flight> flightData)
			throws NewCustomException {
		if (location != null && flightData.size() != 0) {

			Location arrLoc = getLocation(location.substring(0, 3));
			Location depLoc = getLocation(location.substring(3));
			if (arrLoc == null) {
				arrLoc = setLocation(location.substring(0, 3));
			}
			if (depLoc == null) {
				depLoc = setLocation(location.substring(3));
			}

			// System.out.println(arrLoc.getId()+" "+ depLoc.getId());

			SessionFactory factory = HibernateUtil.createSessionFactory();
			for (Flight flight : flightData) {
				Session session = factory.openSession();

				try {

					session.beginTransaction();
					flight.setArrLoc(arrLoc);
					flight.setDepLoc(depLoc);

					session.saveOrUpdate(flight);
					session.getTransaction().commit();
				} catch (HibernateException e) {
					// TODO: handle exception
					throw new NewCustomException(
							"Error in Adding Flight Data to the Database");
				} finally {
					session.close();
				}
			}
		}
	}