public void Post(Models.ContactList contact)
 {
     try
     {
         using (var repo = new Data.ContactsRepository())
         {
             repo.CreateContactList(contact);
         }
     }
     catch (Exception ex)
     {
         Logger.DebugException("Post failed", ex);
         throw;
     }
 }
 // GET api/contactlist/xxx
 public Models.ContactList Get(string id)
 {
     try
     {
         using (var repo = new Data.ContactsRepository())
         {
             return repo.GetContactList(id);
         }
     }
     catch (Exception ex)
     {
         Logger.DebugException("Get failed", ex);
         throw;
     }
 }
 // GET api/contactlist
 public IEnumerable<Models.ContactList> Get()
 {
     try
     {
         using (var repo = new Data.ContactsRepository())
         {
             return repo.GetContactLists();
         }
     }
     catch (Exception ex)
     {
         Logger.DebugException("Get failed", ex);
         throw;
     }
 }
 public void Delete(string id)
 {
     try
     {
         using (var repo = new Data.ContactsRepository())
         {
             repo.DeleteContactList(id);
         }
     }
     catch (Exception ex)
     {
         Logger.DebugException("Delete failed", ex);
         throw;
     }
 }
 public IEnumerable<Models.Contact> GetAutoCompleteContact(string field, string prefix)
 {
     try
     {
         using (var repo = new Data.ContactsRepository())
         {
             return repo.GetAutoCompleteContact(field, prefix);
         }
     }
     catch (Exception ex)
     {
         Logger.DebugException("GetAutoCompleteContact failed", ex);
         throw;
     }
 }
 public void AddContact(AddContactRequest request)
 {
     try
     {
         using (var repo = new Data.ContactsRepository())
         {
             var clist = repo.GetContactList(request.contactlist);
             if (!clist.ContactIds.Contains(request.contact))
             {
                 clist.ContactIds.Add(request.contact);
             }
             repo.UpdateContactList(clist);
         }
     }
     catch (Exception ex)
     {
         Logger.DebugException("AddContact failed", ex);
         throw;
     }
 }