private bool ValidateInputs(LessonUpdateViewModel model, ServiceObjectResponse response)
 {
     float lessonPrice;
     float minimumPrice;
     if (float.TryParse(model.LessonPrice, out lessonPrice) &&
         float.TryParse(model.MinimumPrice, out minimumPrice))
     {
         if (minimumPrice != 0 && lessonPrice == 0.0)
         {
             response.StatusReason = MyMentorResources.lessonPriceIsZero;
             return false;
         }
         if (lessonPrice < minimumPrice)
         {
             return false;
         }
         return true;
     }
     return false;
 }
        public async Task<JsonResult> SetContentItemMetaData(LessonUpdateViewModel model)
        {
            using (var repository = RepositoryFactory.GetInstance(Session))
            {
                var response = new ServiceObjectResponse();
                var existingLesson = repository.FindClipDetails(model.ObjectId);
                var existingLessonStatusId = existingLesson.Status.ObjectId;
                var existingLessonIsActive = existingLesson.Status.GetString("status_en_us") == LessonStatus.Active;
                var stringsManager = new StringsManager(repository);

                if (ValidateInputs(model, response))
                {
                    if (existingLessonIsActive && model.SelectedStatus != existingLessonStatusId)
                    {
                        var clipsBundles = repository.FindBundlesByClipId(model.ObjectId);
                        if (clipsBundles.ClipToBundle.Any())
                        {
                            var isInActiveBundle =
                                clipsBundles.ClipToBundle.Keys.Any(
                                    o => o.Status.Status_en_us == LessonStatus.Active);

                            if (isInActiveBundle)
                            {
                                response.Status = ServiceObjectResponse.Failure;
                                response.StatusReason =
                                    stringsManager.GetLocalizedString(Strings.CannotChangeClipStatusInActiveBundle);
                                return Json(response);
                            }
                        }
                    }

                    var teacher = await repository.FindUserByName(model.TeacherName);
                    if (teacher == null)
                    {
                        response.Status = ServiceObjectResponse.Failure;
                        response.StatusReason = MyMentorResources.updateBundleTeacherNotFound;
                        return Json(response);
                    }
                    model.TeacherId = teacher.ObjectId;

                    model.UserCurrency = new CurrencyRetriver(HttpContext, Session, repository).GetCurrent();

                    await repository.UpdateClipDetails(model, _worldId);

                    response.Status = ServiceObjectResponse.Success;
                    return Json(response);
                }

                response.Status = ServiceObjectResponse.Failure;
                response.StatusReason = string.IsNullOrEmpty(response.StatusReason)
                    ? MyMentorResources.updateLessonGeneralError
                    : response.StatusReason;
                return Json(response);
            }
        }