public void create(Question question, int testId)
        {
            SqlLiteSimpleExecute.execute(queryConfigurator.createQuestion(testId));
            question.Id = DataSetConverter.fromDsToSingle.toInt.convert(SqlLiteSimpleExecute.
                                                                        execute(queryConfigurator.getObjectIdInDevelopStatus(DbTypes.question)));
            SqlLiteSimpleExecute.execute(queryConfigurator.setQuestionContent(question.Id,
                                                                              EncryptWorker.getInstance().encrypt(question.QuestionsContent)));
            SqlLiteSimpleExecute.execute(queryConfigurator.setQuestionType(question.Id,
                                                                           question.QuestionsType));


            for (int i = 0; i < question.Unswers.Count; i++)
            {
                unswerManipalator.create(question.Unswers.ElementAt(i), question.Id);
            }
            SqlLiteSimpleExecute.execute(queryConfigurator.setApproveStatusToObject(
                                             DbTypes.question));
        }
        public void update(Question question)
        {
            if (DataSetConverter.fromDsToSingle.toInt.convert(
                    SqlLiteSimpleExecute.execute(queryConfigurator.countOfObject(question.Id))) == 0)
            {
                throw new ObjectIsNotExistYet();
            }
            SqlLiteSimpleExecute.execute(queryConfigurator.updateQuestionContent(question.Id,
                                                                                 EncryptWorker.getInstance().encrypt(question.QuestionsContent)));


            int rightUnswersCount = 0;

            for (int i = 0; i < question.Unswers.Count; i++)
            {
                if (question.Unswers.ElementAt(i).IsRight)
                {
                    rightUnswersCount++;
                }
            }
            if ((question.QuestionsType.getType().Equals(QuestionTypes.singleAnswer)) &
                (rightUnswersCount == 0 | rightUnswersCount > 1))
            {
                throw new QuestionTypeException();
            }
            if (question.QuestionsType.getType().Equals(QuestionTypes.multiplyAnswer) &
                rightUnswersCount < 2)
            {
                throw new QuestionTypeException();
            }

            if (question.QuestionsType.getType().Equals(DbObjects.multiplyAnswer.getName()))
            {
                SqlLiteSimpleExecute.execute(queryConfigurator.updateQuestionType(question.Id,
                                                                                  DbObjects.multiplyAnswer));
            }
            else
            {
                SqlLiteSimpleExecute.execute(queryConfigurator.updateQuestionType(question.Id,
                                                                                  DbObjects.singleAnswer));
            }

            for (int i = 0; i < question.Unswers.Count; i++)
            {
                try
                {
                    if (question.Unswers.ElementAt(i).IsDeleted)
                    {
                        question.Unswers.ElementAt(i).delete();
                    }
                    else
                    {
                        unswerManipalator.update(question.Unswers.ElementAt(i));
                    }
                }
                catch (ObjectIsNotExistYet ex)
                {
                    unswerManipalator.create(question.Unswers.ElementAt(i), question.Id);
                }
            }
        }