code: function freezeUser(user) {
      if (user.lastLoggedTime) {
          user.lastLoggedTime = Object.freeze(new Date(+user.lastLoggedTime));
      }
      if (user.passwordExpires) {
          user.passwordExpires = Object.freeze(new Date(+user.passwordExpires));
      }
      if (user.confirmationTokenValidTo) {
          user.confirmationTokenValidTo = Object.freeze(new Date(+user.confirmationTokenValidTo));
      }
      if (user.preferences) {
          user.preferences = Object.freeze(user.preferences);
      }
      return domain.freeze(user);
  }
docs: turns the object deeply immutable.
  
  @param user to freeze.
  @return {User} user for convenience.
  
  @internal for library use only.