public Task CreateAsync(SearchCategorySelection categorySelection)
        {
            if (categorySelection == null)
            throw new ArgumentNullException("categorySelection");

              return Task.Factory.StartNew(() =>
              {
            categorySelection.Id = Guid.NewGuid();
            using (IDbConnection connection = CurrentContext.OpenConnection())
              connection.Execute("insert into app_SearchCategorySelections(Id, CakeId, CategoryOptionId) values(@Id, @CakeId, @CategoryOptionId)", categorySelection);
              });
        }
        public Task UpdateAsync(SearchCategorySelection categorySelection)
        {
            if (categorySelection == null)
            throw new ArgumentNullException("categorySelection");

              return Task.Factory.StartNew(() =>
              {
            using (IDbConnection connection = CurrentContext.OpenConnection())
              connection.Execute("update app_SearchCategorySelections SET CakeId=@CakeId, CategoryOptionId=@CategoryOptionId where Id = @Id", categorySelection);
              });
        }
 public Task SaveAsync(SearchCategorySelection categorySelection)
 {
     if (categorySelection.Id == Guid.Empty)
       {
     return CreateAsync(categorySelection);
       }
       else
       {
     return UpdateAsync(categorySelection);
       }
 }