public async Task Update(eFormRentableItemPnDbContext dbContext)
        {
            ContractInspectionItem inspectionItem =
                await dbContext.ContractInspectionItem.FirstOrDefaultAsync(x => x.Id == Id);

            if (inspectionItem == null)
            {
                throw new NullReferenceException($"Could not find inspection item with id: {Id}");
            }

            inspectionItem.SiteId = SiteId;
            inspectionItem.ContractInspectionId = ContractInspectionId;
            inspectionItem.RentableItemId       = RentableItemId;
            inspectionItem.Status    = Status;
            inspectionItem.SDKCaseId = SDKCaseId;

            if (dbContext.ChangeTracker.HasChanges())
            {
                inspectionItem.UpdatedAt       = DateTime.Now;
                inspectionItem.UpdatedByUserId = UpdatedByUserId;
                inspectionItem.Version        += 1;

                await dbContext.ContractInspectionItemVersion.AddAsync(MapVersion(inspectionItem));

                await dbContext.SaveChangesAsync();
            }
        }
        private ContractInspectionItemVersion MapVersion(ContractInspectionItem contractInspectionItem)
        {
            ContractInspectionItemVersion contractInspectionItemVersion = new ContractInspectionItemVersion
            {
                ContractInspectionId = contractInspectionItem.ContractInspectionId,
                CreatedAt            = contractInspectionItem.CreatedAt,
                CreatedByUserId      = contractInspectionItem.CreatedByUserId,
                RentableItemId       = contractInspectionItem.RentableItemId,
                SDKCaseId            = contractInspectionItem.SDKCaseId,
                SiteId                   = contractInspectionItem.SiteId,
                Status                   = contractInspectionItem.Status,
                UpdatedAt                = contractInspectionItem.UpdatedAt,
                UpdatedByUserId          = contractInspectionItem.UpdatedByUserId,
                WorkflowState            = contractInspectionItem.WorkflowState,
                ContractInspectionItemId = contractInspectionItem.Id
            };

            return(contractInspectionItemVersion);
        }