core: fix duplicate smartcards on template update

When updating template, if smart card is enabled,
a new device was created and there was no check for existing device.

fixed to check if device already exist before add.
also added a script to eliminate any existing duplicates.

Change-Id: I14e6779c5c85b514cb953b771c68c5ac1acaafcb
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1101447
Signed-off-by: Omer Frenkel <ofrenkel@redhat.com>