public ResponseContact GetContactByPhoneNumber(PhoneNumberRequest req)
 {
     ResponseContact rc = new ResponseContact();            
     rc.Contact = SQLGetContact(config.getContactByPhoneNumber.Replace("%1", req.PhoneNumber));
     return rc;
 }
        public ResponseContact GetContactByPhoneNumber(PhoneNumberRequest req)
        {
            string phoneNumber = req.PhoneNumber;
            ResponseContact rc = new ResponseContact();

            var ct = from contact in contacts where HasPhoneNumber(contact.PhoneNumbers.PhoneNumber, phoneNumber) select contact;
            if (ct.Count() < 1)
            {
                throw new WebFaultException(HttpStatusCode.NoContent);
            }
            else if (ct.Count() > 1)
            {
                throw new WebFaultException(HttpStatusCode.Conflict);
            }
            Contact retContact = new Contact(ct.FirstOrDefault());

            if ((retContact != null) && (req.CustomAttribute != null))
            {
                if (req.CustomAttribute.Equals("overwrite"))
                {
                    retContact.CustomAttribute = "overwritten custom attribute";
                }
                else if (req.CustomAttribute.Equals("error_never_return"))
                {
                    Thread.Sleep(System.Threading.Timeout.Infinite);
                }
                else if (req.CustomAttribute.Equals("error_internal_server"))
                {
                    throw new WebFaultException<string>("Thrown because error_internal_server was the custom attribute", HttpStatusCode.InternalServerError);
                }
            }

            rc.Contact = retContact;

            return rc;
        }