before model apply