solution with nested attributes