private void updateCollapseAndSelectionStateForSectionChange(int sectionIndex, int delta) {

        // update section collapse state
        HashMap<Integer, Boolean> collapseState = new HashMap<>(collapsedSections);
        collapsedSections.clear();

        for (int i : collapseState.keySet()) {
            // erasure
            if (delta < 0 && i == sectionIndex) {
                continue;
            }

            int j = i;
            if (j >= sectionIndex) {
                j += delta;
            }

            collapsedSections.put(j, collapseState.get(i));
        }

        // update selection state
        HashMap<Integer, SectionSelectionState> selectionState = new HashMap<>(selectionStateBySection);
        selectionStateBySection.clear();

        for (int i : selectionState.keySet()) {
            // erasure
            if (delta < 0 && i == sectionIndex) {
                continue;
            }

            int j = i;
            if (j >= sectionIndex) {
                j += delta;
            }

            selectionStateBySection.put(j, selectionState.get(i));
        }
    }
Post an action to be run later.
RecyclerView doesn't like being mutated during a scroll. We can't detect when a
scroll is actually happening, unfortunately, so the best we can do is post actions
from notify* methods to be run at a later date.

@param action action to run
android/modules/module_common/src/main/java/github/tornaco/android/thanos/widget/section/SectioningAdapter.java