public void UpdateCurrentItemPlayTime() { //TODO: Don't use SelectedItem? What if selection is changed while process is still running? //Only log time if the session lasted more than 5 minutes if (CurrentProcess.RunTime != null && CurrentProcess.RunTime.TotalMinutes > 5) { //The above IF should prevent DateTime.Now actually being used so this is fine DateTime startTime = CurrentProcess.TimeStarted ?? DateTime.Now; DateTime endTime = CurrentProcess.TimeLastPolled ?? DateTime.Now; SelectedItem.AddPlayTime(startTime, endTime); LibraryFiler.SaveLibraryData(); } }