move aop function to common framework