public void Create(CreateMasterTaskDto dto)
        {
            //
            //make sure this task name is unique
            //
            if (_context.MasterTasks.Any(x => x.Name == dto.Name))
            {
                throw new System.Exception("Task name already exists.");
            }

            var mt = _mapper.Map <MasterTask>(dto);

            mt.IntFromHeight = Utility.SanitizeStringToInteger(dto.FromHeight);
            mt.IntToHeight   = Utility.SanitizeStringToInteger(dto.ToHeight);

            var snooksValues = _helperService.CalculateSnooks(new SnooksCalculateDto
            {
                EffortType = mt.EffortType,
                FromHeight = mt.IntFromHeight,
                ToHeight   = mt.IntToHeight,
                WeightLb   = (int)dto.WeightLb
            });

            mt.SnooksMale   = snooksValues.StrMalePercentage;
            mt.SnooksFemale = snooksValues.StrFemalePercentage;

            var nioshIndex = _helperService.GetNioshIndex(new NioshCalculateDto
            {
                EffortType = dto.EffortType,
                FromHeight = mt.IntFromHeight,
                ToHeight   = mt.IntToHeight,
                WeightLb   = (int)dto.WeightLb
            });

            mt.LiftingIndex = nioshIndex;
            foreach (var id in dto.IndustryIds)
            {
                //becuase we are creating multiple tasks
                //we have to clone this
                //
                var mtCloned = (MasterTask)mt.Clone();
                var ind      = _context.Industries.Find(id);
                ind.MasterTasks.Add(mtCloned);
                _context.SaveChanges();
                foreach (int categoryId in dto.CategoryIds)
                {
                    mtCloned.TaskCategoryMaps.Add(new TaskCategoryMap
                    {
                        TaskCategoryId = categoryId,
                        MasterTaskId   = mtCloned.Id
                    });
                }
            }
            _context.SaveChanges();
        }
        public async Task <IActionResult> Create([FromBody] CreateMasterTaskDto dto)
        {
            await Task.Run(() =>
            {
                _masterTaskService.Create(dto);
            });

            return(Ok(new StringResult
            {
                Result = "Created"
            }));
        }