public synchronized void quizFileReWriter(Set<Quiz> quizList)throws RemoteException{
			String filePath = "C:/JavaFiles/QuizManager/QuizMasterFile.csv";
		File file = new File(filePath);
		Set<Question> questionListForNewQuiz=new HashSet<Question>();
		Set<Quiz> quizListWithoutTheFinalisedQuiz=quizList;
		Iterator<Quiz> quizIterator = quizListWithoutTheFinalisedQuiz.iterator();
		Iterator<Question> questionIterator=null;
		BufferedWriter br = null;
		setQuizList(quizList);
		try{
			//set up the writer to re-write records to the QuizMasterFile
			
			br = new BufferedWriter(new FileWriter(file));
			while(quizIterator.hasNext()){
				Quiz quiz = quizIterator.next();
				questionListForNewQuiz=quiz.getQuestionsList();
				questionIterator = questionListForNewQuiz.iterator();
				int totalQuestions=questionListForNewQuiz.size();
				
				br.write(quiz.getQuizId()+ "," + quiz.getQuizTitle()+ ","+ totalQuestions + '\n');
				
				while(questionIterator.hasNext()){
					Question nextQuestion = questionIterator.next();
					String[] choices=nextQuestion.getAnswers();
					String questionId= Integer.toString(nextQuestion.getQuestionId());
					String questionTitle=nextQuestion.getQuestionTitle();
					String choiceOne=choices[0];
					String choiceTwo=choices[1];
					String choiceThree=choices[2];
					String choiceFour=choices[3];
					String correctAnswer=Integer.toString(nextQuestion.getCorrectAnswer());
					String quizId=Integer.toString(nextQuestion.getQuizId());
					br.write(questionId + "," + questionTitle + "," + choiceOne + "," + choiceTwo + "," + choiceThree + "," + choiceFour + "," + correctAnswer + "," + quizId + '\n');
				}
			}
			
			System.out.println("file re-written without the finalised quiz");
		}
		catch (FileNotFoundException ex) {
			System.out.println("File " + file + " does not exist.");
			} 
		catch (IOException ex) {
			ex.printStackTrace();
		}
		finally{
			//closeWriter(bufferedWriterForQuestions);
			closeWriter(br);
		}
	
	}