A few coding style changes.  Moved setting of new_resource.updated_by_last_action(true) within conditions where updates are actually done.