public ActionResult Create(string url, long?productid) { var youtube = new YouTube(url); // try to obtain thumbnail image var imageurl = youtube.GetExternalThumbnailUrl(); if (string.IsNullOrEmpty(imageurl)) { return(Json("Invalid address".ToJsonFail())); } // return thumbnail image, image id, video link var img = imageurl.ReadAndSaveProductImageFromUrl(subdomainid.Value, sessionid.Value, productid); // save video repository.AddVideo(youtube.id, img.id, subdomainid.Value); repository.Save(); return(Json(img.ToModel(Imgsize.MEDIUM, youtube.id).ToJsonOKData())); }