private async Task <IResponse <bool> > CrawlNewPostAsync(IPostRepo postRepo, Page page, int newPostCount) { try { var postCount = 0; var haveNextPage = false; var cursor = string.Empty; var postList = new List <CrawledPostDto>(); do { #region Call Instagram Post Api var postInquiry = await CrawlPostFromInstagramAsync(page.UniqueId, newPostCount, cursor); if (postInquiry.status != "ok") { return new Response <bool> { IsSuccessful = false, Message = ServiceMessage.Error } } ; var postCollection = postInquiry.data.user.edge_Owner_To_Timeline_Media.edges; var totalPostCount = postInquiry.data.user.edge_Owner_To_Timeline_Media.count; cursor = postInquiry.data.user.edge_Owner_To_Timeline_Media.page_Info.end_cursor; haveNextPage = postInquiry.data.user.edge_Owner_To_Timeline_Media.page_Info.has_next_page; #endregion foreach (var post in postCollection) { postCount += 1; var newPost = ConvertToCrawledPostDto(post); newPost.PageId = page.PageId; await postRepo.AddAsync(newPost); } } while (haveNextPage == true && postCount < newPostCount); return(new Response <bool> { Result = true, IsSuccessful = true, Message = ServiceMessage.Success }); } catch (Exception e) { FileLoger.Error(e); return(new Response <bool> { IsSuccessful = false, Message = ServiceMessage.Exception }); } }