@Override
	public boolean registerUser(String username, String password, String email,
			String firstName, String lastName) {
		// Declare a local boolean to be returned by this method, where false
		// means that registration has been unsuccessful
		// (i.e. given username already exists) and true that an user has been
		// registered
		boolean registered = false;

		// Find an user record in the entity bean User, passing a primary key of
		// username.
		User user = emgr.find(entity.User.class, username);
		// Determine whether the user exists
		if (user == null) { // If the user doesn't exists
			// Register the new user
			User newUser = new User();
			newUser.setUserName(username);
			newUser.setPassword(password);
			newUser.setEmail(email);
			newUser.setFirstName(firstName);
			newUser.setLastName(lastName);
			emgr.persist(newUser);
			
			// Obtain the email creditentials to the admin email from the database
			EmailCredential emailCred = emgr.find(EmailCredential.class, "qif");
			
			Runnable r = new EmailSender(emailCred.getEmailLogin(), emailCred.getEmailPassword(), "MiniEbay - Hello !", "You have been successfully registered with us, " + username + ". \n We send u a warm welcome and hope u have a great time with us!",
					emailCred.getEmailLogin(), email);
			new Thread(r).start();
			
			registered = true;
		} // End of registerUser method

		return registered;
	}