Moved update_record logic to relation.rb

The persistence.rb's methods update_record and create_record have similarities in their logic. As the majority of create_records logic is in relation.rb, I moved the update_record logic there as well. Both of the methods now have a similar structure and are easier to understand.

I also extracted value substitution into its own method, which enables both create and update to use the same method as the logic is exactly the same in both cases.

If there's a way to avoid passing the id and id_was variables, that'd be great.