Updated the add/edit question logic for the database