private static PhotosDatabase2 getDatabaseFromIsolatedStorage()
        {
            PhotosDatabase2 database = null;

            using (IsolatedStorageFile isoStore = IsolatedStorageFile.GetStore(IsolatedStorageScope.User | IsolatedStorageScope.Assembly, null, null))
            {
                try
                {
                    using (var iStreamForEndpoint = new IsolatedStorageFileStream(_isolatedStorageDatabaseFileName, FileMode.Open, isoStore))
                    {
                        using (var readerForEndpoint = new StreamReader(iStreamForEndpoint))
                        {
                            var json = readerForEndpoint.ReadToEnd();
                            try
                            {
                                database = JsonConvert.DeserializeObject <PhotosDatabase2>(json);
                            }
                            catch (Exception e)
                            {
                            }
                        }
                    }
                }
                catch (FileNotFoundException)
                {
                    database = null;
                }
            }
            return(database);
        }
 public static void saveDatabaseToIsolatedStorage(PhotosDatabase2 database)
 {
     using (IsolatedStorageFile isoStore = IsolatedStorageFile.GetStore(IsolatedStorageScope.User | IsolatedStorageScope.Assembly, null, null))
     {
         using (var oStream = new IsolatedStorageFileStream(_isolatedStorageDatabaseFileName, FileMode.Create, isoStore))
         {
             using (var writer = new StreamWriter(oStream))
             {
                 var settings = new JsonSerializerSettings {
                     DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate
                 };
                 writer.Write(JsonConvert.SerializeObject(database, settings));
             }
         }
     }
 }