public void StartHandle() { var lines = _parser.ParseFile(FileName); foreach (var line in lines) { using (var uow = new UnitOfWork()) { try { uow.BeginTransaction(); var client = new Client { Name = line.ClientName }; uow.ClientRepository.Save(client); var employee = new Employee { Name = line.EmployeeName }; uow.EmployeeRepository.Save(employee); var product = new Product { Name = line.ProductName, Price = line.ProductSum }; uow.ProductRepository.Save(product); var booking = new Booking { Date = line.Date, Client = client, Employee = employee, Product = product }; uow.BookingRepository.Save(booking); } catch { uow.RollbackTransaction(); } } } File.Move(FileName, FileName + "_"); }