public Iterable<Activity> start(final Activity activity)
{
if (activity != null)
{
Set<Activity> saveMe = new HashSet<Activity>();
Activity runningActivity = findRunningActivity();
if (runningActivity != null && !runningActivity.equals(activity))
{
runningActivity.stop();
saveMe.add(runningActivity);
}
// same day --> resume, init otherwise
if (activity.isToday())
{
activity.resume();
saveMe.add(activity);
}
else
{
Activity copy = activity.copy();
copy.start();
saveMe.add(copy);
}
return saveAll(saveMe);
}
return Collections.emptySet();