public void AddOrUpdate(Revenue revenue) { if (revenue.Id > 0) { var dbRecord = UnitOfWork.RevenueRepository.GetByIdAsNoTracking(revenue.Id); revenue.Created_At = dbRecord.Created_At; UnitOfWork.RevenueRepository.Update(revenue.MapFrom()); } else { UnitOfWork.RevenueRepository.Insert(revenue.MapFrom()); } UnitOfWork.Save(); }