public static JsonObject JsonObject(PushPayload pushPayload)
        {
            var aps = new JsonObject();

            if (pushPayload.Alert != null)
            {
                aps["alert"] = pushPayload.Alert;
            }
            if (pushPayload.Badge != null)
            {
                if (pushPayload.Badge is string)
                {
                    aps["badge"] = pushPayload.Badge as string;
                }
                else if (pushPayload.Badge is int)
                {
                    aps["badge"] = (int)pushPayload.Badge;
                }
                else
                {
                    throw new Exception("Badge is not in valid format");
                }
            }
            if (pushPayload.Sound != null)
            {
                aps["sound"] = pushPayload.Sound;
            }
            return aps;
        }
        public static JsonObject JsonObject(PushPayload pushPayload)
        {
            var aps = new JsonObject();

            if (pushPayload.Alert != null)
            {
                aps["alert"] = pushPayload.Alert;
            }
            if (pushPayload.Badge != null)
            {
                aps["badge"] = pushPayload.Badge;
            }
            if (pushPayload.Sound != null)
            {
                aps["sound"] = pushPayload.Sound;
            }
            return aps;
        }
        private void PushToCustomer(long CustomerID, string Text, long ChallengeID=0)
        {
            IPushServiceTokenRepository tokenRepo = RepoFactory.GetPushServiceTokenRepo();

            AddRegistrationService reg = new AddRegistrationService { RequestBuilder = GetIOSUAProductionCredentials() };
            PushService service = new PushService { RequestBuilder = GetIOSUAProductionCredentials() };

            List<string> pushTokens = new List<string>();

            foreach (PushServiceToken t in tokenRepo.TokensForCustomer(CustomerID))
            {
                reg.Execute(t.Token, new Registration());
                pushTokens.Add(t.Token);
                Trace.WriteLine("PUSH: Registering device token "+t.Token+" for customer "+CustomerID);
            }

            if (pushTokens.Count == 0)
                return;

            PushPayload payload = new PushPayload();
            payload.Alert = Text;
            payload.Badge = "0";

            Trace.WriteLine("PUSH: Pushing \"" + Text + "\" to " + pushTokens.Count.ToString()+" clients - "+pushTokens.ToString());

            Dictionary<string, string> customData=null;

            if (ChallengeID > 0)
            {
                customData = new Dictionary<string, string>();
                customData.Add("dareid", ChallengeID.ToString());
            }
            try
            {
                PushNotification notification = new PushNotification { DeviceTokens = pushTokens, Payload = payload, CustomData=customData };
                service.Execute(notification);
            }
            catch (Exception e)
            {
                Trace.WriteLine("PUSH: Exception encountered, " + e.ToString());
            }
        }