Only clear dirty flag if we're sure the events were uploaded

* Add new/changed id's to a list, and only clear the dirty flag for
  list members
* The implementation is analogous to how deleted items are handled

Bug: 2492857
Change-Id: I3353100ab307a45a5ab684d402253eb589f22008
1 file changed