Refactor the class. Change the handling for the title. The system tries to find a valid rootTitle from the database. If we have no rootTitle the system tries to find a valid pageTitle.