add Factory pattern and implement Student database relation