Added before_save handler