public static string LoadImage(FootballClub club) { string path = Directory.GetCurrentDirectory() + "\\Images"; string imageName = club.Name + "_logo.png"; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } path += "\\" + imageName; var response = client.GetAsync(server + "Clubs/GetLogo/" + club.Id).Result.Content.ReadAsStreamAsync().Result; if (response != null) { FileStream fs = new FileStream(path, FileMode.Create, FileAccess.ReadWrite); response.CopyToAsync(fs).Wait(); response.Close(); fs.Close(); } return(path); }