@Override
	public synchronized void writeDebitTransactionToFile(Transaction transaction) {
		if (debitCounter % BATCH_SIZE == 0 && debitCounter > 0) {
			String newDebitFileName = this.reportDao
					.getCurrentFileName(TransactionType.DEBIT.toString(), debitFileName);

			if (!newDebitFileName.equalsIgnoreCase(debitFileName)) {
				// Close old file
				try {
					flushAndCloseFile(debitFileOut);
				} catch (IOException e) {
					e.printStackTrace();
				}
				debitFileOut = createOutFile(newDebitFileName);
			}
		}

		try {
			this.writeToFile(transaction, this.debitFileOut);
			debitCounter++;
		} catch (IOException e) {
			logger.warn("Could not write debit transaction : " + e.getMessage());
			this.writeDeadLetterTransactionToFile(transaction);
		}
	}