implement checks before insertion

checks for course in the database before it is inserted