public List <ClubAlgolia> Algolia() { // Add the data to Algolia SearchClient client = new SearchClient("ZJ5YQA6729", "ef857c06f1ebf56ed75841fc6c2df18b"); SearchIndex index = client.InitIndex("ClubFoot"); List <ClubAlgolia> clubs = new List <ClubAlgolia>(); foreach (Club club in _context.Clubs.ToList()) { var clubNew = new ClubAlgolia() { ObjectID = club.IdClub.ToString(), Name = club.Name, Address = club.Address, Phone = club.Phone, Email = club.Email, OpeningTime = club.OpeningTime, ClosingTime = club.ClosingTime }; clubs.Add(clubNew); } index.ClearObjects(); // Fetch from DB or a Json file index.SaveObjects(clubs); return(clubs); }