factory refactor by JohnPapa
mapping table for database