public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) {
     DocumentEntity entity = value as DocumentEntity;
     if(!entity.IsNullOrEmpty()) {
         Syncable sync = dbManager.Syncables.FirstOrDefault(x => x.RemoteID == entity.DocumentID);
         return !sync.IsNullOrEmpty();
     }
     return false;
 }
 public static IObservable <FileInfo> ToFile(this IObservable <Stream> source, Syncable syncable)
 {
     if (source.IsNullOrEmpty())
     {
         return(Observable.Never <FileInfo>());
     }
     return(source.SelectMany(inp => {
         //creates directory for file path if the directory is not exists.
         string directory = Path.GetDirectoryName(syncable.LocalPath);
         if (!Directory.Exists(directory))
         {
             Directory.CreateDirectory(directory);
         }
         //check file
         FileInfo outp = new FileInfo(syncable.LocalPath);
         //delete if there is any such file
         if (outp.Exists)
         {
             outp.Delete();
         }
         using (FileStream output = File.Create(outp.FullName))
             using (GZipStream compress = new GZipStream(inp, CompressionMode.Decompress)) {
                 //create stream and copy
                 compress.CopyTo(output);
                 //close compression
                 compress.Close();
                 output.Close();
                 //retrun observable
                 return Observable.Return(new FileInfo(syncable.LocalPath));
             }
     }));
 }