added before and implemented resultClass in model