public async Task <User> RemoveActivityAsync(int userIdToLog, int userLogIdToRemove) { int activeUserId = GetActiveUserId(); var activeUser = await _userRepository.GetByIdAsync(activeUserId); int authUserId = GetClaimId(ClaimType.UserId); if (userIdToLog == activeUserId || activeUser.HouseholdHeadUserId == authUserId || HasPermission(Permission.LogActivityForAny)) { var userLog = await _userLogRepository.GetByIdAsync(userLogIdToRemove); int pointsToRemove = userLog.PointsEarned; await _userLogRepository.RemoveSaveAsync(authUserId, userLogIdToRemove); return(await RemovePointsSaveAsync(authUserId, userIdToLog, pointsToRemove)); } else { string error = $"User id {authUserId} cannot remove activity for user id {userIdToLog}"; _logger.LogError(error); throw new GraException(error); } }