@SuppressWarnings("unchecked")
	public void syncTransactions() {
		
		File tempFile = new File("plugins/EdgeConomy/transactions.tmp");
		
		try {
			
			ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(tempFile));			
			out.writeObject(transactions);
			out.close();
			
			transactions.clear();
			
			ObjectInputStream in = new ObjectInputStream(new FileInputStream(tempFile));			
			transactions = (HashMap<Integer, Transaction>) in.readObject();			
			in.close();
			
			Date now = Calendar.getInstance().getTime();
			int days = 0;
			
			for (Transaction transaction : transactions.values()) {
				while(transaction.getDate().before(now)) {
					days++;
				}
				
				if (days >= TransactionManager.expireAfterDays)
					removeTransaction(transaction.getID());
			}
			
		} catch(Exception e) {
			e.printStackTrace();
		}
	}