public void UpdateCBTContent(UpdateCBTContentInput cbtContent)
        {
            try
            {
                List <int> options = new List <int>();
                var        cbt     = _cbtContentRepository.Get(cbtContent.CBTContentId);
                cbt.PrecedingCBTContentId = cbtContent.PrecedingCBTContentId;
                cbt.Code                = cbtContent.Code;
                cbt.Description         = cbtContent.Description;
                cbt.Required            = cbtContent.Required;
                cbt.OnlyNumericValue    = cbtContent.OnlyNumericValue;
                cbt.IncludeComment      = cbtContent.IncludeComment;
                cbt.AllowMultipleChoice = cbtContent.AllowMultipleChoice;
                cbt.CategoryId          = cbtContent.CategoryId;
                cbt.ContentTypeId       = cbtContent.ContentTypeId;
                cbt.FileName            = cbtContent.FileName;
                cbt.Location            = cbtContent.Location;
                cbt.CBTContentOption    = new List <CBTContentOptions>();

                options = _cbtContentOptionsRepository.GetAll().Where(o => o.CBTContent.Id == cbtContent.CBTContentId).Select(i => i.Id).ToList();
                for (int i = 0; i < cbtContent.CBTContentOption.Count(); i = i + 3)
                {
                    var index = options.FindIndex(a => a.Equals(Convert.ToInt32(cbtContent.CBTContentOption[i])));
                    options.RemoveAt(index);
                }

                for (int k = 0; k < options.Count(); k++)
                {
                    var delOpts = _cbtContentOptionsRepository.Get(Convert.ToInt32(options[k]));
                    _cbtContentOptionsRepository.Delete(delOpts);
                }

                for (int j = 0; j < cbtContent.CBTContentOption.Count(); j = j + 3)
                {
                    CBTContentOptions newOpt = new CBTContentOptions();

                    if (cbtContent.CBTContentOption[j] != "")
                    {
                        newOpt = _cbtContentOptionsRepository.Get(Convert.ToInt32(cbtContent.CBTContentOption[j]));
                    }
                    newOpt.OptionValue = cbtContent.CBTContentOption[j + 1];
                    newOpt.DataType    = cbtContent.CBTContentOption[j + 2];

                    cbt.CBTContentOption.Add(newOpt);
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
        //public async Task CreateCBTContent(CreateCBTContentInput input)
        //{
        //    var cbtContentList = ObjectMapper.Map<CBTContent>(input);
        //    await _cbtContentRepository.InsertAsync(cbtContentList);
        //}

        public async Task CreateCBTContent(string input)
        {
            try
            {
                CreateCBTContentInput cbtContent = JsonConversionHelper.ConvertFromJson <CreateCBTContentInput>(input);

                CBTContent cbt = new CBTContent();
                cbt.PrecedingCBTContentId = cbtContent.PrecedingCBTContentId;
                cbt.Code                = cbtContent.Code;
                cbt.Description         = cbtContent.Description;
                cbt.Required            = cbtContent.Required;
                cbt.OnlyNumericValue    = cbtContent.OnlyNumericValue;
                cbt.IncludeComment      = cbtContent.IncludeComment;
                cbt.AllowMultipleChoice = cbtContent.AllowMultipleChoice;
                cbt.CategoryId          = cbtContent.CategoryId;
                cbt.ContentTypeId       = cbtContent.ContentTypeId;
                cbt.FileName            = cbtContent.FileName;
                cbt.Location            = cbtContent.Location;
                cbt.CBTContentOption    = new List <CBTContentOptions>();

                for (int j = 0; j < cbtContent.CBTContentOption.Count(); j = j + 2)
                {
                    CBTContentOptions newOpt = new CBTContentOptions();
                    newOpt.OptionValue = cbtContent.CBTContentOption[j];
                    newOpt.DataType    = cbtContent.CBTContentOption[j + 1];
                    cbt.CBTContentOption.Add(newOpt);
                }

                //var cbtContentList = ObjectMapper.Map<CBTContent>(cbt);
                await _cbtContentRepository.InsertAsync(cbt);
            }
            catch (Exception e)
            {
                throw e;
            }
        }