public static boolean commitToFile(ArrayList<Employee> employees, String filePath) 
	{

		try {

			DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
			Document employeeDoc;
			DocumentBuilder docBuilder = dbFactory.newDocumentBuilder();
			employeeDoc = docBuilder.newDocument();

			Element rootElement = employeeDoc.createElement("Company");
			
			final int count = employees.size();
			for (int i = 0; i < count; ++i) {
				final Employee employee = employees.get(i);
				
				Element employeeElement = employeeDoc.createElement("Employee");
				
				
				Element firstNameElement = employeeDoc.createElement("FirstName");
                firstNameElement.setTextContent(employee.getFirstName());
                
				Element lastNameElement = employeeDoc.createElement("LastName");
				lastNameElement.setTextContent(employee.getLastName());
                
                
				Element hoursWorkedElement = employeeDoc.createElement("HoursWorked");
				hoursWorkedElement.setTextContent(Integer.toString(employee.getHours()));
                
                
				Element payRateElement = employeeDoc.createElement("PayRate");
				payRateElement.setTextContent(Double.toString(employee.getPayRate()));                
                
                
				employeeElement.appendChild(firstNameElement);
				employeeElement.appendChild(lastNameElement);
				employeeElement.appendChild(hoursWorkedElement);
				employeeElement.appendChild(payRateElement);
				rootElement.appendChild(employeeElement);
			}
			
			TransformerFactory transformerFactory = TransformerFactory.newInstance();
			Transformer transformer = transformerFactory.newTransformer();
			DOMSource source = new DOMSource(rootElement);
			
			StreamResult result = new StreamResult(new File(filePath));
			transformer.setOutputProperty(OutputKeys.INDENT, "yes");
			transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
			transformer.transform(source, result);

		} catch (Exception e) {
			return false;
		}

		return true;
	}