public void Insert(Subscription subscription)
 {
     using (IDbConnection connection = OpenConnection())
     {
         IEnumerable<Subscription> selectedSubscription = connection.Query<Subscription>(@"select * from subscription where PhoneId=@PhoneId", subscription);
         if (selectedSubscription == null || !selectedSubscription.Any())
         {
             connection.Execute(@"insert into Subscription(PhoneId, Uri) values (@PhoneId, @Uri)", subscription);
         }
         else
         {
             connection.Execute(@"update Subscription set Uri = @Uri where PhoneId = @PhoneId", subscription);
         }
     }
 }
 // POST /api/subscription
 public void Post(string phoneId, string channelUri)
 {
     try
     {
         var subscription = new Subscription();
         subscription.PhoneId = phoneId;
         subscription.Uri = channelUri;
         subscriptionRepository.Insert(subscription);
     }
     catch (Exception error)
     {
         ErrorSignal.FromCurrentContext().Raise(error);
         throw;
     }
 }