public bool UpdateAffiliation(AffiliationUpdate model)
 {
     using (var ctx = new ApplicationDbContext())
     {
         var entity =
             ctx
             .Affiliations
             .Single(e => e.Id == model.Id);
         entity.Group       = model.Group;
         entity.Description = model.Description;
         return(ctx.SaveChanges() == 1);
     }
 }
        public IHttpActionResult Put(AffiliationUpdate model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var service = CreateAffiliationService();

            if (!service.UpdateAffiliation(model))
            {
                return(InternalServerError());
            }
            return(Ok());
        }