public SaveSession(final JBroFuzzWindow mWindow) throws Exception {

		// Set the fuzzing tab as the one showing
		mWindow.setTabShow(JBroFuzzWindow.ID_PANEL_FUZZING);
		if (JBroFuzz.PREFS.get(JBroFuzzPrefs.DBSETTINGS[11].getId(), "").toLowerCase().trim().equals("couchdb")){
			// DTOCreator dtoC = new DTOCreator();
		//	CouchDBHandler couchHandler = new CouchDBHandler();
			if (JBroFuzz.PREFS.get(JBroFuzzPrefs.DBSETTINGS[12].getId(), "").length() <= 0  || JBroFuzz.PREFS.get(JBroFuzzPrefs.DBSETTINGS[12].getId(), "").equals("")){
				
				/*
				//start from scratch
				String dbName = "";
				String documentId = "";
				Date dat = new Date();
				long sessionid = dat.getTime();
				SessionDTO session = dtoC.createSessionDTO(mWindow, sessionid);
				CouchDBMapper cdbMapper = new CouchDBMapper();
				JSONObject document = cdbMapper.toCouch(session);
				String dbNameReal = couchHandler.createDB(dbName);
				couchHandler.createOrUpdateDocument(dbNameReal, documentId, document);
				*/
			}
			else if (JBroFuzz.PREFS.get(JBroFuzzPrefs.DBSETTINGS[12].getId(), "").length() > 0 && !JBroFuzz.PREFS.get(JBroFuzzPrefs.DBSETTINGS[12].getId(), "").equals("")){
				//use provided dbName
				/*
				Date dat = new Date();
				String documentId = dat.getYear() + "_" + dat.getMonth() + "_" + dat.getDay() + "_" + dat.getHours() + ":" + dat.getMinutes();
				long sessionid = dat.getTime();
				SessionDTO session = dtoC.createSessionDTO(mWindow, sessionid);
				CouchDBMapper cdbMapper = new CouchDBMapper();
				JSONObject document = cdbMapper.toCouch(session);
				couchHandler.createOrUpdateDocument(JBroFuzz.PREFS.get(JBroFuzzPrefs.DBSETTINGS[12].getId(), ""), documentId, document);
				*/
			}
			else{
				throw new Exception("No DB Name provided");
			}
		}
		else if(JBroFuzz.PREFS.get(JBroFuzzPrefs.DBSETTINGS[11].getId(), "").toLowerCase().trim().equals("sqlite")){
			// write to SQLite in case somebody did sessin to file and now decides to go sqlite for whatever reason
			/*
			DTOCreator dtoC = new DTOCreator();
			SQLiteHandler sqlH = new SQLiteHandler();
			sqlH.setUpDB();
			String dbName = JBroFuzz.PREFS.get(JBroFuzzPrefs.DBSETTINGS[12].getId(), "");
			if (dbName.length() == 0 || dbName.equals("")){
				Date dat = new Date();
				dbName = String.valueOf(dat.getTime());
			}
			Connection con = sqlH.getConnection(dbName);
			SessionDTO session = dtoC.createSessionDTO(mWindow, -1);
			sqlH.store(session, con);
			*/
		}
		else {
			// If there is a file already opened, save there
			if (mWindow.isCurrentFileOpened()) {

				final File myFile = mWindow.getCurrentFileOpened();
				Save.writeFile(myFile, mWindow);
				mWindow.setOpenFileTo(myFile);

				final String parentDir = myFile.getParent();
				if (parentDir != null) {
					JBroFuzz.PREFS
							.put(JBroFuzzPrefs.DIRS[2].getId(), parentDir);
				}

			} else {
				// If no file is open, create a new 'Save As' session
				new SaveAsSession(mWindow);

			}	
		}
	}