Anonymous behaviour of http.get and store in sqlite database

I’ve 9 categories in my website.
I wanted to pull the post for this categories in my app and store in my sqlite database, display.

I’ve two tables in sqlite.
POST Table -> which contains all the information of post.
LOOKUP Table -> which contains mapping of CATEGORYID and POSTID.

I’ve three methods:

mainMethod has a for loop over categories list

getPostsFromWebsite fetches post for particular catID

insertPost inserts the post in the POST DATABASE TABLE and POSTID, CATEGORYID in LOOKUP table.

public mainMethod(){
for (let i = 0; i < this.categoriesList.length; i++) {
	this.url = '<url>/?cat=' + this.categoriesList[i].id;
    this.posts = [];
    this.getPostsFromWebsite(this.categoriesList[i].id);
	}
}



 private getPostsFromWebsite(catID: number){
    this.http.get(this.url)
      .map(res => res.json())
      .subscribe(data => {
        this.items = data;
        this.posts = data.posts;
        this.insertPosts(catID);
        },
      err => {
        this.alertPopUp("Please check your internet connection.","We aren't able to load some datas from the server.");
        console.info("Connection: " + err);
      });
  }

public insertPosts(){
   code to first check if the post is already inserted into the database or not
   if not then insert the post in the POST DATABASE TABLE
   and in LOOKUP DATABASE TABLE which contains CATEGORYID and POSTID
  }

Since the http.get is async, the LOOKUP table has anonymous behaviour of inserting
POSTID for other CATEGORYID which it doesn’t belong.

So while browsing category in my categories page of an app,
some categories shows the post of other categories.

Is there any way to fix this issue?