public async Task <IActionResult> CreateMultipleServiceCategories([FromBody] SaveMultipleServiceCategories resource) { try { _repository.DeleteServiceServiceTypesByServiceId(resource.ServiceId); var serviceCategories = resource.ServiceCategoryId; var lstCategories = new List <ServiceServiceTypes>(); foreach (var s in serviceCategories) { var input = new ServiceServiceTypes { ServiceId = resource.ServiceId, ServiceCategoryId = s, ServiceTypeId = resource.ServiceTypeId }; _repository.AddServiceCategory(input); lstCategories.Add(input); } return(Ok(lstCategories)); } catch (Exception x) { return(BadRequest(x.Message)); } }