public ActionResult <User> buyResource([FromBody] UserLessonDTO dto)
        {
            var user   = new User();
            var lesson = new Package();

            try
            {
                if (userService.UserExists(dto.userId))
                {
                    user = userService.GetUser(dto.userId);
                }
                else
                {
                    BadRequest("User was not found.");
                }
            } catch (Exception e)
            {
                BadRequest(e);
            }

            if (packageService.PackageExists(dto.lessonName))
            {
                lesson = packageService.GetPackage(dto.lessonName);
            }
            else
            {
                BadRequest("Lesson was not found.");
            }

            if (user.Credits == 0 || lesson.Cost > user.Credits)
            {
                BadRequest("User has too little credits to buy this lesson.");
            }

            user = userService.UpdateUserCredit(dto.userId, user.Credits, -lesson.Cost);
            packageService.AddRecourceAccess(dto.userId, dto.lessonName);
            return(user);
        }