protected function createUser($username, $email, $password, $parentGroup = null, $fields = array())
    {
        $userCreateStruct = $this->userService->newUserCreateStruct(
            $username,
            $email,
            $password,
            self::DEFAULT_LANGUAGE
        );
        $userCreateStruct->setField('first_name', $username);
        $userCreateStruct->setField('last_name', $username);

        foreach ($fields as $fieldName => $fieldValue) {
            $userCreateStruct->setField($fieldName, $fieldValue);
        }

        try {
            $existingUser = $this->userService->loadUserByLogin($username);
            $this->userService->deleteUser($existingUser);
        } catch (NotFoundException $e) {
            // do nothing
        }

        if (!$parentGroup) {
            $parentGroup = $this->userService->loadUserGroup(self::USERGROUP_ROOT_CONTENT_ID);
        }

        $user = $this->userService->createUser($userCreateStruct, array($parentGroup));

        return $user;
    }