def put(self, course_id, chapter_id):
        data = parser.parse_args()
        data['course_id'] = course_id

        chapter = ChapterModel.find_by_id(chapter_id)

        if chapter is None:
            new_chapter = ChapterModel(**data)
            try:
                new_chapter.save()

                return new_chapter.json(), 201
            except:
                return {
                    "message": "An error occurred while updating Chapter."
                }, 500

        try:
            chapter.update(**data)
        except:
            return {
                "message": "An error occurred while updating Chapter."
            }, 500

        return chapter.json(), 200
    def post(self, course_id):
        data = parser.parse_args()
        data['course_id'] = course_id

        chapter = ChapterModel(**data)
        try:
            chapter.save()
        except:
            return {
                "message": "An error occurred while inserting Chapter."
            }, 500

        update_steps_number(course_id)

        return chapter.json(), 201