public DataEvento Adicionar(DataEvento model) { if (model.Valid) { using (RepositorySession dalSession = new RepositorySession(Runtime.JWInstance)) { IUnitOfWork unitOfWork = dalSession.UnitOfWork; unitOfWork.Begin(); try { if (_repository.PesquisarporDataeCongregacao(ref unitOfWork, model) != null) { model.AddNotification(nameof(model.Data), Errors.EventExists); unitOfWork.Rollback(); return(model); } _repository.Inserir(ref unitOfWork, model); unitOfWork.Commit(); } catch { unitOfWork.Rollback(); throw; } } } return(model); }