public IHttpActionResult Put(BookClubBookJoinEdit model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var service = CreateBookClubBookJoinService();

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

            return(Ok());
        }
        public bool UpdateBookClubBookJoin(BookClubBookJoinEdit model)
        {
            using (var ctx = new ApplicationDbContext())
            {
                var entity =
                    ctx
                    .BookClubBookJoins
                    .Single(e => e.ScheduleName == model.ScheduleName);
                entity.BookId       = ctx.Books.FirstOrDefault(x => x.Name == model.BookName).Id;
                entity.StartDate    = model.StartDate;
                entity.EndDate      = model.EndDate;
                entity.BookName     = model.BookName;
                entity.BookClubId   = ctx.BookClubs.FirstOrDefault(x => x.Name == model.BookClubName).BookClubId;
                entity.BookClubName = model.BookClubName;
                entity.ModifiedUtc  = DateTimeOffset.Now;

                return(ctx.SaveChanges() == 1);
            }
        }