public IActionResult SaveEntity(AdvertiserViewModel advertiserVm)
 {
     if (!ModelState.IsValid)
     {
         IEnumerable <ModelError> allErrors = ModelState.Values.SelectMany(v => v.Errors);
         return(new BadRequestObjectResult(allErrors));
     }
     else
     {
         if (advertiserVm.KeyId == 0)
         {
             _advertiserService.Add(advertiserVm);
         }
         else
         {
             _advertiserService.Update(advertiserVm);
         }
         _advertiserService.Save();
         return(new OkObjectResult(advertiserVm));
     }
 }
        public ActionResult <ItemResponse <int> > Create(AdvertiserAddRequest model)
        {
            ObjectResult result = null;

            try
            {
                int id = _service.Add(model);
                ItemResponse <int> response = new ItemResponse <int>()
                {
                    Item = id
                };
                result = Created201(response);
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.ToString());
                ErrorResponse response = new ErrorResponse(ex.Message);

                result = StatusCode(500, response);
            }
            return(result);
        }