private WriteableBitmap DecodeGif(MemoryStream stream)
        {
            stream.Seek(0, SeekOrigin.Begin);

            var gd = new GifDecoder();
            int status = gd.Read(stream);
            if (status == GifDecoder.STATUS_OK)
            {
                return gd.GetImage();
            }

            return null;
        }