public async Task <IActionResult> CreateSurvey([FromBody] SurveyToAdd command)
        {
            try{
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }
                var surveyTemplateId = await _surveyTemplateService.CreateSurveyAsync(command);

                return(Json(surveyTemplateId));
            }
            catch (Exception e) {
                return(BadRequest(e.Message));
            }
        }
        public async Task <int> CreateSurveyAsync(SurveyToAdd command)
        {
            var surveyTemplateId = await CreateAsync(command.Title, command.Description);

            if (command.Questions == null)
            {
                throw new NullReferenceException("Cannot create empty survey");
            }
            foreach (var question in command.Questions)
            {
                var questionTemplateId = await AddQuestionToSurveyAsync(surveyTemplateId, question.QuestionPosition,
                                                                        question.Content, question.Select, question.IsRequired);

                if (question.FieldData == null)
                {
                    throw new NullReferenceException("Question must contain FieldData");
                }
                foreach (var fieldData in question.FieldData)
                {
                    await AddChoiceOptionsAndRowsAsync(questionTemplateId, question.Select, fieldData);
                }
            }
            return(surveyTemplateId);
        }