public async Task <IActionResult> PutAsync(int id, [FromBody] SaveBenefitResource resource)
        {
            var benefit = _mapper.Map <SaveBenefitResource, Benefit>(resource);
            var result  = await _benefitService.UpdateAsync(id, benefit);

            if (!result.Success)
            {
                return(BadRequest(result.Message));
            }

            var benefitResource = _mapper.Map <Benefit, BenefitResource>(result.Resource);

            return(Ok(benefitResource));
        }
        public async Task <IActionResult> PostAsync([FromBody] SaveBenefitResource resource)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState.GetErrorMessages()));
            }

            var benefit = _mapper.Map <SaveBenefitResource, Benefit>(resource);
            var result  = await _benefitService.SaveAsync(benefit);

            if (!result.Success)
            {
                return(BadRequest(result.Message));
            }

            var benefitResource = _mapper.Map <Benefit, BenefitResource>(result.Resource);

            return(Ok(benefitResource));
        }