public void PersistDeviceIdentifier(DeviceIdentifier deviceIdentifier)
 {
     ApplicationData.Current.LocalSettings.Values["deviceconfig"] = deviceIdentifier.ToString();
 }
 private static async Task<DeviceRegistration> RegisterDeviceAsync(DeviceIdentifier? deviceIdentifier)
 {
     using (var client = new HouseOfTheFutureApiHost())
     {
         var response = await client.IotRegister
             .PostWithOperationResponseAsync(new RegisterIotDeviceRequest
             {
                 CurrentDeviceId = deviceIdentifier?.ToString()
             });
         
         return new DeviceRegistration
         {
             DeviceIdentifier = new DeviceIdentifier(response.Body.DeviceId),
             HubDeviceKey = response.Body.HubDeviceKey,
             IsConfigured = response.Body.IsConfigured ?? false
         };
     }            
 }