public async Task <ActionResult <DelayedChargeLineModel> > Post(int DelayedChargeId, DelayedChargeLineModel model)
        {
            try
            {
                //Make sure DelayedChargeLineId is not already taken
                var existing = await _repository.GetDelayedChargeLineAsync(DelayedChargeId, model.Id);

                if (existing != null)
                {
                    return(BadRequest("DelayedChargeLine Id in Use"));
                }

                //map
                var DelayedChargeLine = _mapper.Map <DelayedChargeLine>(model);

                //save and return
                if (!await _repository.StoreNewDelayedChargeLineAsync(DelayedChargeId, DelayedChargeLine))
                {
                    return(BadRequest("Bad request, could not create record!"));
                }
                else
                {
                    var location = _linkGenerator.GetPathByAction("Get",
                                                                  "DelayedChargeLine",
                                                                  new { DelayedChargeLine.DelayedChargeId, DelayedChargeLine.Id });

                    return(Created(location, _mapper.Map <DelayedChargeLineModel>(DelayedChargeLine)));
                }
            }
            catch (Exception e)
            {
                _logger.LogError(e, e.Message);
                return(this.StatusCode(StatusCodes.Status500InternalServerError, "Database Failure"));
            }
        }
        public async Task <ActionResult <DelayedChargeLineModel> > Put(int DelayedChargeId, int Id, DelayedChargeLineModel updatedModel)
        {
            try
            {
                var currentDelayedChargeLine = await _repository.GetDelayedChargeLineAsync(DelayedChargeId, Id);

                if (currentDelayedChargeLine == null)
                {
                    return(NotFound($"Could not find DelayedChargeLine with Id of {Id}"));
                }

                _mapper.Map(updatedModel, currentDelayedChargeLine);

                if (await _repository.UpdateDelayedChargeLineAsync(DelayedChargeId, currentDelayedChargeLine))
                {
                    return(_mapper.Map <DelayedChargeLineModel>(currentDelayedChargeLine));
                }
            }
            catch (Exception e)
            {
                _logger.LogError(e, e.Message);
                return(this.StatusCode(StatusCodes.Status500InternalServerError, "Database Failure"));
            }

            return(BadRequest());
        }