private static bool BundleInvalid(ShoppoingCartItemModel cartItemModel, IMyMentorRepository repository, StringsManager stringManager, string currentUserId, ref bool contentItemActive, ref bool canBeOrderedByTeacher, ref bool contentItemOwner, out Purchase existingPurchase, out ParseObject result)
        {
            Bundle bundle = Task.Run(() => repository.FindMinimalBundleById(cartItemModel.ContentItemId)).Result;

            existingPurchase = repository.FindPurchaseByContentIdAndUserId(cartItemModel.ContentItemId, currentUserId);
            contentItemActive = bundle.IsActive();
            canBeOrderedByTeacher = bundle.CanBeOrderedByTeacher(currentUserId);
            result = bundle;
            contentItemOwner = currentUserId == bundle.Teacher.ObjectId;

            if (existingPurchase == null)
            {
                return false;
            }

            if (existingPurchase.PurchaseStatusCode == PurchaseStatusCodes.PackagePurchased ||
                existingPurchase.PurchaseStatusCode == PurchaseStatusCodes.PackageIsActive)
            {
                if (existingPurchase.ClipKind == ClipPurchaseTypes.Bundle)
                {
                    cartItemModel.ErrorMessage = stringManager.GetLocalizedString(Strings.BundleAlreadyPurchased);
                }
                return true;
            }

            if (existingPurchase.PurchaseStatusCode == PurchaseStatusCodes.DemoOrdered ||
                existingPurchase.PurchaseStatusCode == PurchaseStatusCodes.DemoIsActive)
            {
                if (existingPurchase.ClipKind == ClipPurchaseTypes.Demo)
                {
                    cartItemModel.ErrorMessage = stringManager.GetLocalizedString(Strings.DemoAlreadyOrdered);
                }
                return true;
            }

            if (existingPurchase.PurchaseStatusCode == PurchaseStatusCodes.PackageIsInBasket)
            {
                cartItemModel.ErrorMessage = stringManager.GetLocalizedString(Strings.BundleAlreadyInBasket);
                return true;
            }

            return false;
        }