private void AssignImages(bsi_posts post, string parentID) { //Upload associated images string index = ""; int count = 1; string imagePath = @"P:/products/" + post.bsi_posting.brand + @"/" + post.sku + ".jpg"; while (File.Exists(imagePath)) { catalogProductAttributeMediaCreateEntity media = UploadProductImage(imagePath, count, post.sku + index); _proxy.catalogProductAttributeMediaCreate(_sessionID, parentID.ToString(), media, null, "product ID"); count++; index = "-" + count.ToString(); imagePath = @"P:/products/" + post.bsi_posting.brand + @"/" + post.sku + index + ".jpg"; } }