Fixed duplicate database entries issue for Tasks