@Before(EXECUTION_SAVE)
public void beforeSave(JoinPoint joinPoint) {
for (Object object : joinPoint.getArgs()) {
// If the object is base model and it's on the servlet
// context, It's not executed by task scheduling.
SpringContext springContext = getSpringContext();
if (object instanceof BaseModel
&& (springContext.isServletRequestContext() || springContext.isUnitTestContext())) {
BaseModel<?> model = (BaseModel<?>) object;
Date lastModifiedDate = new Date();
model.setLastModifiedDate(lastModifiedDate);
User currentUser = userContext.getCurrentUser();
model.setLastModifiedUser(userRepository.findOne(currentUser.getId()));