public async void Import() { IEnumerable <Quote> quotes = await this.GetQuotes(); var context = new ApplicationDbContext(); IDbRepository <SQL.Quote> repo = new DbRepository <SQL.Quote>(context); var quotesService = new QuotesService(repo); foreach (var quote in quotes) { if (repo.All().Any(q => q.Text.ToLower() == quote.Text.ToLower())) { continue; } quotesService.Add(new SQL.Quote() { Text = quote.Text, Author = this.LoadOrCreateAuthor(context, quote.Author, quote.AuthorImageUrl), CreatedOn = DateTime.Now, ModifiedOn = DateTime.Now, IsDeleted = false, Tags = quote.Tags.Select(tag => new SQL.Tag { Name = tag } ).ToList() }); Console.Write("."); } Console.WriteLine("Done!"); }