public bool ReportHop(HopArrivalModel hopModel) { try { var truck = _truckRepository.GetByCode(hopModel.Code); var warehouse = _warehouseRepository.GetByCode(hopModel.Code); var parcel = _parcelRepository.GetByTrackingCode(hopModel.TrackingId); if (truck == null && warehouse == null) { throw new Exception("Location code invalid"); } if (parcel == null) { throw new Exception("Parcel trackingId invalid"); } _hopRepository.Create(Mapper.Map <HopArrivalModel, HopArrivalDTO>(hopModel)); _logger.Info(string.Format("Parcel '{0}' has been scanned at LocationCode '{1}'. Timestamp: {2}", hopModel.TrackingId, hopModel.Code, hopModel.DateTime)); return(true); } catch (Exception ex) { throw new BLException("BL error reporting hop: " + ex.Message, ex); } }