void WriteStream <T>(IInStream <T> source, IIOStream <IInStream <T> > dest, int index)
 {
     if (dest.Length < (index + 1))
     {
         dest.Length = index + 1;
     }
     using (var w = dest.GetWriter())
     {
         w.Position = index;
         if (source == null)
         {
             w.Write(StreamUtils.GetEmptyStream <T>());
         }
         else
         {
             w.Write(source);
         }
     }
 }