public async Task <ApiResult> Handle(InsertAutomation request, CancellationToken cancellationToken) { using (var scope = _unitOfWorkFactory.Create()) { var result = await _automationService.Insert(request, cancellationToken); if (result.Success) { scope.Commit(); } return(result); } }