Fixed adding visit records, added logic for updating visit records.