added logic for database insertion and add person dialog