Made a generic system for loading object from database