Optimal risk exchange in controlled structural systems