/// <summary>
 /// Update a contact from the request Cache.
 /// </summary>
 /// <param name="contact"></param>
 /// <returns></returns>
 public bool Update(Contact contact)
 {
     return this.Delete(contact.Id) && this.Insert(contact);
 }
 public HttpResponseMessage Put(HttpRequestMessage request, Contact contact)
 {
     return this.ContactDao.Update(contact)
         ? request.CreateResponse(HttpStatusCode.NoContent)
         : request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Unable to update contact");
 }
        /// <summary>
        /// Save contact into request Cache.
        /// </summary>
        /// <param name="contact"></param>
        /// <returns></returns>
        public bool Insert(Contact contact)
        {
            if (this.Cache == null) return false;

            try
            {
                var currentContacts = (IEnumerable<Contact>) this.Cache[CacheKey];
                this.Cache[CacheKey] = currentContacts.Concat(new[] { contact });

                return true;
            }
            catch (Exception ex)
            {
                Console.WriteLine("Unable to insert new contact. " + ex.Message);
                return false;
            }
        }