/// <summary>
 /// Add a new thumbnail or video still image to a video, or assign an existing image to another video.
 /// </summary>
 /// <param name="image">The metadata for the image you'd like to create (or update).</param>
 /// <param name="fileToUpload">The full path of the file to be uploaded.</param>
 /// <param name="videoReferenceId">The reference ID of the video to which you'd like to assign the image.</param>
 /// <param name="resize">Set this to false if you don't want your image to be automatically resized to the default size for its type. 
 /// By default images will be resized.</param>
 /// <returns>The image that was added or updated</returns>
 public BrightcoveImage AddImage(BrightcoveImage image, string fileToUpload, string videoReferenceId, bool resize)
 {
     return DoAddImage(image, fileToUpload, -1, videoReferenceId, resize);
 }
 /// <summary>
 /// Add a new thumbnail or video still image to a video, or assign an existing image to another video.
 /// </summary>
 /// <param name="image">The metadata for the image you'd like to create (or update).</param>
 /// <param name="fileToUpload">The full path of the file to be uploaded.</param>
 /// <param name="videoReferenceId">The reference ID of the video to which you'd like to assign the image.</param>
 /// <returns>The image that was added or updated</returns>
 public BrightcoveImage AddImage(BrightcoveImage image, string fileToUpload, string videoReferenceId)
 {
     return AddImage(image, fileToUpload, videoReferenceId, true);
 }
        private BrightcoveImage DoAddImage(BrightcoveImage image, string fileToUpload, long videoId, string videoReferenceId, bool resize)
        {
            string fileName;
            byte[] fileBytes;
            GetFileUploadInfo(fileToUpload, out fileName, out fileBytes);

            string propName;
            object propValue;
            GetIdValuesForUpload(videoId, videoReferenceId, "video_id", "video_reference_id", out propName, out propValue);

            BrightcoveParamCollection parms = CreateWriteParamCollection("add_image",
                                                                         methodParams =>
                                                                         {
                                                                             methodParams.Add("image", image);
                                                                             methodParams.Add("resize", resize.ToString().ToLower());
                                                                             methodParams.Add(propName, propValue);
                                                                         });

            return RunFilePost<BrightcoveResultContainer<BrightcoveImage>>(parms, fileName, fileBytes).Result;
        }
 /// <summary>
 /// Add a new thumbnail or video still image to a video, or assign an existing image to another video.
 /// </summary>
 /// <param name="image">The metadata for the image you'd like to create (or update).</param>
 /// <param name="fileToUpload">The full path of the file to be uploaded.</param>
 /// <param name="videoId">The ID of the video to which you'd like to assign the image.</param>
 /// <param name="resize">Set this to false if you don't want your image to be automatically resized to the default size for its type. 
 /// By default images will be resized.</param>
 /// <returns>The image that was added or updated</returns>
 public BrightcoveImage AddImage(BrightcoveImage image, string fileToUpload, long videoId, bool resize)
 {
     return DoAddImage(image, fileToUpload, videoId, null, resize);
 }
 /// <summary>
 /// Add a thumbnail asset to the specified audio track.
 /// </summary>
 /// <param name="image">A BrightcoveImage containing the metadata for the image you'd like to create (or update).</param>
 /// <param name="fileToUpload">The full path of the file to be uploaded.</param>
 /// <param name="audioTrackReferenceId">The reference ID of the audio track to which you'd like to assign the image.</param>
 /// <returns>The image that was added or updated.</returns>
 public BrightcoveImage AddAudioImage(BrightcoveImage image, string fileToUpload, string audioTrackReferenceId)
 {
     return AddAudioImage(image, fileToUpload, audioTrackReferenceId, true);
 }
 /// <summary>
 /// Add a thumbnail asset to the specified audio track.
 /// </summary>
 /// <param name="image">A BrightcoveImage containing the metadata for the image you'd like to create (or update).</param>
 /// <param name="fileToUpload">The full path of the file to be uploaded.</param>
 /// <param name="audioTrackReferenceId">The reference ID of the audio track to which you'd like to assign the image.</param>
 /// <param name="resize">Set this to false if you don't want your image to be automatically resized to the default size for its type. 
 /// By default images will be resized.</param>
 /// <returns>The image that was added or updated.</returns>
 public BrightcoveImage AddAudioImage(BrightcoveImage image, string fileToUpload, string audioTrackReferenceId, bool resize)
 {
     return DoAddAudioImage(image, fileToUpload, -1, audioTrackReferenceId, resize);
 }
 /// <summary>
 /// Add a thumbnail asset to the specified audio track.
 /// </summary>
 /// <param name="image">A BrightcoveImage containing the metadata for the image you'd like to create (or update).</param>
 /// <param name="fileToUpload">The full path of the file to be uploaded.</param>
 /// <param name="audioTrackId">The ID of the audio track to which you'd like to assign the image.</param>
 /// <param name="resize">Set this to false if you don't want your image to be automatically resized to the default size for its type. 
 /// By default images will be resized.</param>
 /// <returns>The image that was added or updated.</returns>
 public BrightcoveImage AddAudioImage(BrightcoveImage image, string fileToUpload, long audioTrackId, bool resize)
 {
     return DoAddAudioImage(image, fileToUpload, audioTrackId, null, resize);
 }