refractor code add apientity class to restobject class