public async Task AddItemAsync(Project project, INavigateToSearchResult result, CancellationToken cancellationToken) { var node = await _graphBuilder.CreateNodeAsync(result, cancellationToken).ConfigureAwait(false); if (node != null) { // _context.OutputNodes is not threadsafe. So ensure only one navto callback can mutate it at a time. lock (this) _context.OutputNodes.Add(node); } }