class RunEntityService extends AbstractEntityService<
        Run,
        RunAddPayload,
        RunGateway> {

    public RunTimeAddedPayload addTimeToFirstRunInSequenceWithoutRawTime(RunAddTimePayload addTimePayload)
            throws EntityNotFoundException, AddEntityException {
        RunTimeAddedPayload runTimeAddedPayload = new RunTimeAddedPayload();
        Run firstRunInSequenceWithoutTime = gateway.findFirstInSequenceWithoutTime(addTimePayload.getEvent());
        if (firstRunInSequenceWithoutTime != null) {
            firstRunInSequenceWithoutTime.setRawTime(addTimePayload.getRawTime());
            Run runWithRawTimeAssigned = gateway.save(
                    firstRunInSequenceWithoutTime.getId(),
                    firstRunInSequenceWithoutTime
            );
            runTimeAddedPayload.setRun(runWithRawTimeAssigned);
            runTimeAddedPayload.setOutcome(RunTimeAddedPayload.Outcome.RUN_RAWTIME_ASSIGNED_TO_EXISTING);
        } else {
            // Consider error reporting for this scenario.
            // There has possibly been a false finish trip, or perhaps a car managed to stage and launch without
            // being noticed by Timing workers. Recommend to hold start while resolving situation.
            RunAddPayload addPayload = new RunAddPayload();
            addPayload.setEvent(addTimePayload.getEvent());
            addPayload.setTimestamp(Instant.now());
            addPayload.setRawTime(addTimePayload.getRawTime());
            Run addedRun = add(addPayload);
            runTimeAddedPayload.setRun(addedRun);
            runTimeAddedPayload.setOutcome(RunTimeAddedPayload.Outcome.RUN_ADDED_WITH_RAWTIME);
        }
        return runTimeAddedPayload;
    }

    @Inject public  RunEntityService(RunGateway gateway, EventEntityService eventEntityService);

}