System task checking caused duplicate task

Previously whenever you called system.tasks all tasks
from candlepin were duplicated within the db every time.
It was not checking properly that the tasks already existed.
Also the logic was confusing.  This should clear it up a good bit