public static byte[] CreateSubscriptionFile(Subscription info)
        {
            XElement rootElement = new XElement("subscription");
            rootElement.Add(new XElement("id", info.SubscriptionId));
            rootElement.Add(new XElement("name", info.Name));

            return Encoding.UTF8.GetBytes(rootElement.ToString());
        }
        public static Subscription GetSubscriptionFromFile(byte[] file)
        {
            if (file.Length <= 0) return null;

            XDocument doc = XDocument.Parse(System.Text.Encoding.UTF8.GetString(file, 0, file.Length));

            Subscription info = new Subscription()
            {
                SubscriptionId = doc.Root.Element("id").Value,
                Name = doc.Root.Element("name").Value,
                RequiresCertificatePassword = false,
                CertificatePassword = "******"
            };

            return info;
        }
		private void SaveSubscriptionInfo()
		{
			IsolatedStorageFile myStore = IsolatedStorageFile.GetUserStoreForApplication();

			Subscription info = new Subscription()
			{
				SubscriptionId = SubscriptionId,
				Name = SubscriptionName
			};

			// Build a small XML document to hold the details...
			//
			byte[] fileBytes = SubscriptionManager.CreateSubscriptionFile(info);

			string detailsFileName = SubscriptionId + "\\details.xml";
			FileMode mode = FileMode.Create;

			using (var isoFileStream = new IsolatedStorageFileStream(detailsFileName, mode, myStore))
			{
				isoFileStream.Write(fileBytes, 0, fileBytes.Length);
			}
		}