private void CreateUser(ISession session, string username, string hashedPassword) { bool first = !session.Query<LocalUser>().Any(); var user = new LocalUser { HashedPassword = hashedPassword, Username = username }; session.SaveOrUpdate (user); if (!first) { PermissionProvider.CreatePermissions (session, user.UserId, PermissionName.SendAudio, PermissionName.RequestUserList, PermissionName.RequestSource, PermissionName.RequestChannelList, PermissionName.ChangeChannel); } else { PermissionProvider.CreatePermissions (session, user.UserId, (PermissionName[])Enum.GetValues (typeof(PermissionName))); } }