Take a look at the Nested callbacks and Promise pattern - Click Here