private async Task <string> createWindowsPhoneRegistration(Registration clientRegistration, ISet <string> tags)
        {
            string newId = string.Empty;

            // Register either a standard toast notification using templates or a raw noative notification
            // depending on what is requested buy the client.
            switch (clientRegistration.Type)
            {
            case "toast":
                var template = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                               "<wp:Notification xmlns:wp=\"WPNotification\">" +
                               "<wp:Toast>" +
                               "<wp:Text1>{'Northwind ' + $(feed) + ' data was ' + $(operation) + '...'}</wp:Text1>" +
                               "<wp:Text2>{'Entity: ' + $(entity)}</wp:Text2>" +
                               "</wp:Toast>" +
                               "</wp:Notification>";

                // Register for the templated toast notification, and return the ID.
                newId = clientRegistration.RegistrationId =
                    (await hubClient.CreateMpnsTemplateRegistrationAsync(
                         clientRegistration.ChannelUri, template, tags)).RegistrationId;
                break;

            case "auto-update":
                // Register for the raw notification used by auto-updates, and return the ID.
                newId = clientRegistration.RegistrationId = (await hubClient.CreateMpnsNativeRegistrationAsync(
                                                                 clientRegistration.ChannelUri, tags)).RegistrationId;
                break;

            default:
                throw new DataServiceException("Unexpected notification type.");
            }
            return(newId);
        }