Remoaving duplicate code in car endpoint