public void Save(Contact contact) { using (var session = _context.OpenSession()) { try { var contactAux = new Contact { Name = contact.Name, Company = contact.Company, Address = contact.Address, Ativo = contact.Ativo }; session.Save(contactAux); using (var transaction = session.BeginTransaction()) { foreach (var item in contact.Telephones) { item.ContactId = contactAux.Id; _telephoneRepository.Save(item); } foreach (var item in contact.Emails) { item.ContactId = contactAux.Id; _emailRepository.Save(item); } transaction.Commit(); } } catch (Exception ex) { } } }