Update selectedAnnotations at annotationUpdate event

If we got annotations selected in the sidebar and delete one, the filter
doesn't get updated. Alas, if we delete the last selected annotation then
the sidebar will show zero annotations but the filter will still say:
"Showing x annotations..."

This fix gives a new listener to the annotationDeleted event and properly
updates the selected annotation dict and count if needed.

Fix #1591
This code is now repeated many times[1][2][3] in the services file, and the behaviour vary's each time, lets pull it out into a function so we only have to define it once.

[1] https://github.com/hypothesis/h/blob/1591-clear-filter-if-selection-is-empty/h/static/scripts/services.coffee#L219-L225
[2] https://github.com/hypothesis/h/blob/1591-clear-filter-if-selection-is-empty/h/static/scripts/services.coffee#L239-L240
[3] https://github.com/hypothesis/h/blob/1591-clear-filter-if-selection-is-empty/h/static/scripts/services.coffee#L260-L265