public void UpdatePersonalUserInfo(UserPersonalInfoDto user, string email) { try { var existing = _unitOfWork.Users.GetById(id: user.Id); if (existing == null) { throw new ArgumentException("User does not exists"); } if (existing.Email != email) { throw new ArgumentException("Operation not allowed"); } user.UpdateEntity(existing); _activityService.LogActivity(new Activity { UserId = existing.Id, Importance = ActivityImportance.Medium, Type = ActivityType.UserUpdate, Data = JsonConvert.SerializeObject(existing) }); _unitOfWork.Users.Update(existing); _unitOfWork.Save(); } catch (ArgumentException) { throw; } catch (Exception e) { _logger.LogError(e.Message); throw new Exception("Error while updating user info. Please try a bit later"); } }