public IObservable <IThreadSafeTimeEntry> Execute() => dataSource.GetAll(te => te.IsDeleted == false && te.Duration == null, includeInaccessibleEntities: true) .Select(timeEntries => timeEntries.SingleOrDefault() ?? throw new NoRunningTimeEntryException())
public IObservable <ITransition> Start() => dataSource .GetAll(suitableForDeletion) .SelectMany(dataSource.DeleteAll) .Select(_ => FinishedDeleting.Transition());
private IObservable <IThreadSafeProject> notReferencedByAnyTimeEntryOrNull(IThreadSafeProject project) => timeEntriesDataSource.GetAll(timeEntry => timeEntry.ProjectId == project.Id) .Select(referencingTimeEntries => referencingTimeEntries.Any()) .Select(isReferencedByAnyTimeEntry => isReferencedByAnyTimeEntry ? null : project);