public StoreTaskDetails Run(RunDetails runDetails, IStoreCommand command, IStore store, CancellationToken cancellationToken) { Stopwatch sw = new Stopwatch(); sw.Start(); Task <GroupOperationCost> task = command.DoAsync(store, cancellationToken); StoreTaskDetails taskDetails = new StoreTaskDetails(command, store, task); task.ContinueWith(t => { sw.Stop(); taskDetails.Elapsed = sw.Elapsed; if (task.IsCompleted) { taskDetails.Cost = task.Result; } }, cancellationToken); return(taskDetails); }