OOIION-1749 Ensure state object is flushed on publication

@edwardhunter - Can you please review.

I slightly diverged on when we flush in the ASP.