public async Task <IActionResult> AddUserToFile(string fileKey, [FromBody] AddUserToFileRequest request) { try { var userKey = _contextAccessor.UserKeyFromContext(); bool userCanAccessFile = await UserCanAccessFile(userKey, fileKey, _hiarcDatabase, AccessLevelGroup.CoOwner); if (userCanAccessFile) { await _hiarcDatabase.AddUserToFile(fileKey, request); return(Ok(new Empty())); } else { return(StatusCode(StatusCodes.Status403Forbidden)); } } catch (ArgumentException argEx) { return(BuildErrorResponse(argEx, _logger, StatusCodes.Status400BadRequest)); } catch (Exception ex) { return(BuildErrorResponse(ex, _logger)); } }