public HttpResponseMessage Get() { var sendersList = _senderService.GetSenders().ToList(); if (sendersList.Count > 0) { var senvm = sendersList.Select(sen => new SenderViewModel() { SenderId = sen.SenderId, ForName1 = sen.ForName1, ForName2 = sen.ForName2, AddressLine1 = sen.AddressLine1, AddressLine2 = sen.AddressLine2, AddressLine3 = sen.AddressLine3, SurName = sen.SurName, Title = sen.Title, Country = sen.Country, Email = sen.Email, Mobile = sen.Mobile, Postcode = sen.Postcode, SenderPassword = sen.SenderPassword, Telephone = sen.Telephone, HMRCUserId = sen.HMRCUserId, HMRCPassword = sen.HMRCPassword, Type = sen.Type }); return(Request.CreateResponse <IEnumerable <SenderViewModel> >(HttpStatusCode.OK, senvm)); } //return Request.CreateResponse<IEnumerable<SenderViewModel>>(HttpStatusCode.OK, senvm); if (sendersList == null || sendersList.Count == 0) { throw new HttpResponseException(HttpStatusCode.NotFound); } return(Request.CreateResponse(HttpStatusCode.NoContent, "empty")); }