Updated getting courses

Updated some logic that deletes every entity before adding them again.
This is also working while being deployed