public bool PendingQuestionFormAcceptUpdated(PendingQuestionForm entity)
        {
            //Check permission: Admin
              PrincipalPermission permissionAdm =
            new PrincipalPermission(Thread.CurrentPrincipal.Identity.Name, "Administrator");
              permissionAdm.Demand();

              TraceCallEnterEvent.Raise();
              try
              {
            //Check required fields
            if (entity.ID.IsNull)
              throw new ArgumentNullException("PendingQuestionForm.ID", "Az elbírálandó kérdõív azonosítója nincs megadva.");
            if (entity.ProgramCategoryId.Length == 0)
              throw new ArgumentNullException("PendingQuestionForm.ProgramCategoryId",
                                          "Az elbírálandó kérdõív kategóriája nincs megadva.");
            if (entity.TemplateRef.IsNull)
              throw new ArgumentNullException("PendingQuestionForm.TemplateRef", "A sablon azonosítója nincs megadva.");
            if (entity.Details.AllCount == 0)
              throw new ArgumentNullException("PendingQuestionForm.Details", "A válaszok nincsenek megadva.");
            if (entity.QuestionFormRef.IsNull)
              throw new ArgumentNullException("PendingQuestionForm.QuestionFormRef",
                                          "Az eredeti kérdõív azonosítója nincs megadva.");

            if (entity.ProgramCategoryId.Equals("ORG"))
            {
              if (entity.OrganisationID.IsNull)
            throw new ArgumentNullException("PendingQuestionForm.OrganisationID",
                                            "A szervezet azonosítója nincs megadva.");
            }
            else
            {
              if (entity.ProgramID.IsNull)
            throw new ArgumentNullException("PendingQuestionForm.ProgramID", "A program azonosítója nincs megadva.");
            }

            // Logical checks:
            PendingQuestionForm selected = base.PendingQuestionFormSelect(entity.ID);
            if (selected == null)
              throw new ApplicationException("A megadott azonosítóval nem létezik elbírálandó kérdõív.");
            if (!selected.Status.Equals(QuestionFormStatus.Updated_WaitingForDecision))
              throw new ApplicationException("Csak jóváhagyásra váró státuszú kérdõív bírálható el.");
            QuestionFormService questionFormService = new QuestionFormService(m_DataContext);
            QuestionForm questionForm = questionFormService.QuestionFormSelect(entity.QuestionFormRef);
            if (questionForm == null)
              throw new ApplicationException("A megadott azonosítóval nem létezik kérdõív.");

            // Set properties
            selected.DecidedBy = Thread.CurrentPrincipal.Identity.Name;
            selected.DecidedDate = DBDateTime.Now;
            selected.Status = QuestionFormStatus.Updated_Accepted;
            selected.QuestionFormRef = entity.QuestionFormRef;
            selected.IsActual = true;
            //utolsó módosítás, és elfogadás dátuma
            questionForm.LastModifiedDate = selected.SentDate;
            questionForm.DecidedDate = selected.DecidedDate;
            questionForm.IsActual = true;
            //Set mail:
            string modifiedAnswers = "";
            PendingQuestionFormDetailContainer origAnswers = base.SelectChildrenByDetailOfPendingQuestionForm(entity.ID);
            TemplateDetailService templateDetailService = new TemplateDetailService(m_DataContext);
            foreach (PendingQuestionFormDetail origDetail in origAnswers.All)
            {
              string hash = origDetail.HashString();
              PendingQuestionFormDetail currentDetail = (PendingQuestionFormDetail) entity.Details[hash];
              if (currentDetail != null)
              {
            if (!origDetail.Answer.Equals(currentDetail.Answer))
            {
              TemplateDetail question =
                templateDetailService.TemplateDetailSelect(origDetail.TemplateDetailRef, origDetail.TemplateRef);
              modifiedAnswers += "Kérdés:  " + question.Question + "\n";
              modifiedAnswers += "  Eredeti válasz:    " + origDetail.Answer + "\n";
              modifiedAnswers += "  Módosított válasz: " + currentDetail.Answer + "\n\n";
            }
              }
            }
            if (modifiedAnswers.Length == 0)
            {
              modifiedAnswers = "  A jóváhagyó módosítás nélkül fogadta el a kitöltött kérdõívet.\n";
            }

            UserService userSrv = new UserService(m_DataContext);
            User sentBy = userSrv.UserSelect(selected.SentBy);
            Email mail = new Email(Guid.NewGuid());
            mail.Category = EmailCategory.QuestionFormUpdateAccept;
            mail.To = sentBy.Email;

            //Subject és body lekérdezése
            string body = "";
            string subject = "";
            EmailTemplateService srvTemplate = new EmailTemplateService();
            srvTemplate.GetEmailTemplateByCode(ref subject, ref body, EmailCategory.QuestionFormUpdateAccept);

            mail.Subject = subject;

            body = body.Replace("<FULL_USER_NAME>", sentBy.Name);
            body = body.Replace("<SENT_DATE>", entity.SentDate.ToString());
            body = body.Replace("<TEMPLATE_NAME>", entity.TemplateName);
            body = body.Replace("<MODIFIED_ANSWERS>", modifiedAnswers);
            mail.MailBody = body;

            // Save data to database
            EmailService emailSrv = new EmailService(m_DataContext);
            QuestionFormDetailService questionFormDetailService = new QuestionFormDetailService(m_DataContext);
            m_DataContext.BeginNestedTran();
            try
            {
              questionFormService.QuestionFormUpdate(questionForm);

              base.PendingQuestionFormUpdate(selected);
              questionFormService.DeleteChildrenByDetailOfQuestionForm(entity.QuestionFormRef);
              foreach (PendingQuestionFormDetail pendingDetail in entity.Details.All)
              {
            QuestionFormDetail detail =
              new QuestionFormDetail(entity.QuestionFormRef, pendingDetail.TemplateDetailRef, entity.TemplateRef);
            detail.Answer = pendingDetail.Answer;
            detail.FreetextId = Guid.NewGuid();
            questionFormDetailService.QuestionFormDetailInsert(detail);
              }
              emailSrv.EmailInsert(mail);
              m_DataContext.CommitNested();
            }
            catch
            {
              m_DataContext.RollbackNested();
              throw;
            }

            // Sending mail:
            try
            {
              emailSrv.EmailSend(mail.ID);
            }
            catch (Exception ex)
            {
              ExceptionManager.Publish(ex);
              return false;
            }

            // Log success
            BusinessAuditEvent.Success(
              new EventParameter("PendingQuestionFormID", entity.ID.ToString()),
              new EventParameter("ProgramID", entity.ProgramID.ToString()),
              new EventParameter("OrganisationID", entity.OrganisationID.ToString())
              );
            TraceCallReturnEvent.Raise();
            return true;
              }
              catch (Exception ex)
              {
            ExceptionManager.Publish(ex);
            BusinessAuditEvent.Fail(
              new EventParameter("Exception", ex.ToString()),
              new EventParameter("PendingQuestionFormID", entity.ID.ToString()),
              new EventParameter("ProgramID", entity.ProgramID.ToString()),
              new EventParameter("OrganisationID", entity.OrganisationID.ToString())
              );
            TraceCallReturnEvent.Raise(false);
            throw;
              }
        }