public boolean addUser(String username, String password, String email) {

        String passwordHash = makePasswordHash(password, Integer.toString(random.nextInt()));

        // XXX WORK HERE
        // create an object suitable for insertion into the user collection
        // be sure to add username and hashed password to the document. problem instructions
        // will tell you the schema that the documents must follow.
        BasicDBObject doc = new BasicDBObject("username", username);
        doc.put("password", passwordHash);



        if (email != null && !email.equals("")) {
            // XXX WORK HERE
            // if there is an email address specified, add it to the document too.
            doc.put("email", email);
        }

        try {
            // XXX WORK HERE
            // insert the document into the user collection here
            usersCollection.insert(doc);
            return true;
        } catch (MongoException.DuplicateKey e) {
            System.out.println("Username already in use: " + username);
            return false;
        }
    }