periodSet.add(newPeriod);
user.getPeriods().add(newPeriod);
newSite.getPeriods().add(newPeriod);
// a default student must be added to the new period
User studentUser = UserService.get().newUser();
studentUser.setRole(Role.STUDENT);
studentUser.setFirstName("Student");
studentUser.setLastName(newPeriod.getName());
studentUser.setUsername(newPeriod.getName());
studentUser.getPeriods().add(newPeriod);
studentUser.setValid(true);
studentUser.setCreateDate(new Date());
// create a random number for the password
Random randomNumber = new Random();
Integer studentPasswordInteger = randomNumber.nextInt();
studentPassword = studentPasswordInteger.toString().substring(0, 6);
log.debug("this is the student password : {}", studentPassword);
studentUser.setPassword(studentPassword);
// add the teacher and the default student to the new default class
userSet.add(studentUser);
newPeriod.setUsers(userSet);