public async Task RegisterUser(UserDto user) { var userEntity = await _blogContext.Users.FirstOrDefaultAsync(); if (userEntity != null) { _blogContext.Users.Remove(userEntity); } await _blogContext.Users.AddAsync(new Database.Models.User() { Name = user.Name, Email = user.Email, PasswordHash = _hashService.Generate(user.Password), LastPasswordChangeDate = DateTime.UtcNow }); await _blogContext.SaveChangesAsync(); }