some codes with Active Record Callbacks