public async Task <GasPump> UpdatePumpState(IEndpointContext context, string StoreNumber, long id, GasPumpState state)
        {
            var request  = new UpdatePumpStateDataRequest(StoreNumber, id, state);
            var response = await context.ExecuteAsync <UpdatePumpStateDataResponse>(request).ConfigureAwait(false);

            return(response.Pump);
        }
        private Response UpdatePumpState(UpdatePumpStateDataRequest request)
        {
            var pumps = GasPumpsDataService.GasPumpsByStore[request.StoreNumber];

            if (pumps == null)
            {
                throw new DataValidationException(DataValidationErrors.Microsoft_Dynamics_Commerce_Runtime_ObjectNotFound);
            }

            var pump = pumps.First((p) => p.Id == request.PumpId);

            pump.State = request.State;
            if (pump.State.GasPumpStatus == GasPumpStatus.Pumping || pump.State.GasPumpStatus == GasPumpStatus.PumpingComplete)
            {
                pump.State.SaleTotal = GetSaleTotal(pump.State.SaleVolume);
            }

            return(new UpdatePumpStateDataResponse(pump));
        }