} // CreateStoreRatingService

        /// <summary>
        /// Edits a Store Rating
        /// </summary>
        /// <param name="storeRating"></param>
        /// <returns></returns>
        public IHttpActionResult Put(StoreRatingEdit storeRating)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var service = CreateStoreRatingService();

            if (!service.UpdateStoreRating(storeRating))
            {
                return(InternalServerError());
            }

            return(Ok());
        } // Put
        } // GetStoreRatingById

        public bool UpdateStoreRating(StoreRatingEdit model)
        {
            using (var ctx = new ApplicationDbContext())
            {
                var entity =
                    ctx
                    .StoreRatings
                    .Single(e => e.StoreRatingId == model.StoreRatingId && e.OwnerId == _userId);

                entity.Store.CulumativeRating = entity.Store.CulumativeRating - entity.StoreIndividualRating;
                entity.Store.CulumativeRating = model.StoreIndividualRating + entity.Store.CulumativeRating;
                entity.Store.StoreRating      = entity.Store.CulumativeRating / entity.Store.NumberOfRatings;

                entity.StoreId = model.StoreId;
                entity.StoreIndividualRating = model.StoreIndividualRating;

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