/// <inheritdoc />
		public HttpContent ConvertToHttpContent(Type typeToConvert, object content)
		{
			if (!CanConvertToHttpContent(typeToConvert, content))
			{
				return null;
			}

			var bitmap = content as Bitmap;
			if (bitmap == null) return null;

			Stream stream = new MemoryStream();
			var httpBehaviour = HttpBehaviour.Current;

			var configuration = httpBehaviour.GetConfig<BitmapConfiguration>();

			var encoder = ImageCodecInfo.GetImageEncoders().FirstOrDefault(x => x.FormatID == configuration.Format.Guid);
			if (encoder != null)
			{
				var parameters = new EncoderParameters(configuration.EncoderParameters.Count);
				var index = 0;
				foreach (var encoderParameter in configuration.EncoderParameters)
				{
					parameters.Param[index++] = encoderParameter;
				}
				bitmap.Save(stream, encoder, parameters);
			}
			else
			{
				var exMessage = $"Can't find an encoder for {configuration.Format}";
				Log.Error().WriteLine(exMessage);
				throw new NotSupportedException(exMessage);
			}
			stream.Seek(0, SeekOrigin.Begin);

			// Add progress support, if this is enabled

			if (httpBehaviour.UseProgressStream)
			{
				var progressStream = new ProgressStream(stream)
				{
					BytesRead = (sender, eventArgs) => { httpBehaviour.UploadProgress?.Invoke((float) eventArgs.StreamPosition/eventArgs.StreamLength); }
				};
				stream = progressStream;
			}

			var httpContent = new StreamContent(stream);
			httpContent.Headers.Add("Content-Type", "image/" + configuration.Format.ToString().ToLowerInvariant());
			return httpContent;
		}
		/// <inheritdoc />
		public HttpContent ConvertToHttpContent(Type typeToConvert, object content)
		{
			if (CanConvertToHttpContent(typeToConvert, content))
			{
				var bitmapSource = content as BitmapSource;
				if (bitmapSource != null)
				{
					var httpBehaviour = HttpBehaviour.Current;
					var configuration = httpBehaviour.GetConfig<BitmapSourceConfiguration>();
					Stream stream = new MemoryStream();
					var encoder = configuration.CreateEncoder();
					encoder.Frames.Add(BitmapFrame.Create(bitmapSource));
					encoder.Save(stream);
					stream.Seek(0, SeekOrigin.Begin);

					// Add progress support, if this is enabled
					if (httpBehaviour.UseProgressStream)
					{
						var progressStream = new ProgressStream(stream)
						{
							BytesRead = (sender, eventArgs) => { httpBehaviour.UploadProgress?.Invoke((float) eventArgs.StreamPosition/eventArgs.StreamLength); }
						};
						stream = progressStream;
					}

					var httpContent = new StreamContent(stream);
					httpContent.Headers.Add("Content-Type", "image/" + configuration.Format.ToString().ToLowerInvariant());
					return httpContent;
				}
			}
			return null;
		}
		/// <inheritdoc />
		public HttpContent ConvertToHttpContent(Type typeToConvert, object content)
		{
			var httpBehaviour = HttpBehaviour.Current;

			var stream = content as Stream;

			// Add progress support, if this is enabled
			if (httpBehaviour.UseProgressStream)
			{
				var progressStream = new ProgressStream(stream)
				{
					BytesRead = (sender, eventArgs) => { httpBehaviour.UploadProgress?.Invoke((float) eventArgs.StreamPosition/eventArgs.StreamLength); }
				};

				stream = progressStream;
			}
			return new StreamContent(stream);
		}