public MediaTransformResult TransformStream(Stream stream, out Stream transformedStream)
{
var decoder = BitmapDecoder.Create(stream, BitmapCreateOptions.None, BitmapCacheOption.Default);
BitmapSource bitmapSource = decoder.Frames[0];
bitmapSource = _bitmapTransformChain.Aggregate(bitmapSource, (current, transform) => transform(current));
_encoder.Frames.Add(BitmapFrame.Create(bitmapSource));
transformedStream = new MemoryStream();
_encoder.Save(transformedStream);
transformedStream.Seek(0, SeekOrigin.Begin);
return MediaTransformResult.Success;
}