def asyncUpdateContact(self):
        v = self.view
        c_id = self.contact.c_id
        first_name = v.first_name.text()
        last_name = v.last_name.text()
        tel = v.telephone.text()
        email = v.email.text()
        url = v.url.text()
        notes = v.notes.toPlainText()

        if (first_name != "" and first_name is not None and last_name != ""
                and last_name is not None):
            modified_contact = ContactModel()
            modified_contact.setFields(first_name, last_name, tel, email, url,
                                       notes)
            modified_contact.updateContact(c_id)

            tag_contact_model = ContactTagModel()
            tag_contact_model.setContactId(c_id)

            tag_contact_model.deleteContactTagsFromId()

            tags = v.scrollAreaWidgetContents.layout()

            items = (tags.itemAt(i).widget() for i in range(tags.count()))
            # select checked tags and add the info in ContactsTags table as a tuple (c_id, t_id)
            for i in items:
                if i.isChecked():
                    tag_model = TagModel()
                    tag_id = tag_model.getTagIdfromName(i.text())
                    contact_tag_model = ContactTagModel()
                    contact_tag_model.setContactId(c_id)
                    contact_tag_model.setTagId(tag_id)
                    contact_tag_model.addContactTag()
    def addContact(self):
        first_name = self.view.first_name.text()
        last_name = self.view.last_name.text()
        telephone = self.view.telephone.text()
        email = self.view.email.text()
        url = self.view.url.text()
        notes = self.view.notes.toPlainText()

        # check for minimum data required
        if ((first_name is not None and first_name != "")
                or (last_name is not None and last_name != "")
                and telephone is not None and telephone != ""):
            new_contact = ContactModel()
            new_contact.setFields(first_name, last_name, telephone, email, url,
                                  notes)
            new_contact.addContact()

            # get the contact id from Contacts table in "ContactsManager.db".
            c_id = new_contact.getContactIdFromNameTel()

            # select checked tags and add the info in ContactsTags table as a tuple (c_id, t_id)
            tags = self.view.scrollAreaWidgetContents.layout()
            items = (tags.itemAt(i).widget() for i in range(tags.count()))
            for i in items:
                if i.isChecked():
                    # print("checked", i)
                    tag_model = TagModel()
                    tag_id = tag_model.getTagIdfromName(i.text())
                    contact_tag_model = ContactTagModel()
                    contact_tag_model.setContactId(c_id)
                    contact_tag_model.setTagId(tag_id)
                    contact_tag_model.addContactTag()
        self.showContactList()