Saving main model together with its has_many and belongs_to associations