CAUTION: I wouldn't actually put so much workflow coordination on the client-side. Instead, I would put all of this behind a single asynchronous call to the server API. I am doing this here - in AngularJS - because the framework is JavaScript and has Promises. As such, it makes it really easy to test with; and, it makes it quite applicable to other asynchronous server-side technologies like Node.js.