Wrapped route and segment creation in a transaction so that if one fails the other is rolled back