refactor regester models func

no need write same code