public async Task <IActionResult> Update([FromBody] PharmacySystem pharmacySystem)
 {
     if (pharmacySystem.isValid())
     {
         var pharmacyOld = _pharmacySystemService.GetPharmacyByIdNoTracking(pharmacySystem.Id);
         if (pharmacyOld == null)
         {
             throw new ArgumentNullException("There is no pharmacy with id=" + pharmacySystem.Id);
         }
         if (pharmacySystem.ActionsBenefitsExchangeName == null)
         {
             pharmacySystem.ActionsBenefitsSubscribed = false;
         }
         if (await _actionBenefitService.SubscriptionEdit(pharmacyOld.ActionsBenefitsExchangeName,
                                                          pharmacyOld.ActionsBenefitsSubscribed,
                                                          pharmacySystem.ActionsBenefitsExchangeName,
                                                          pharmacySystem.ActionsBenefitsSubscribed))
         {
             _pharmacySystemService.UpdatePharmacy(pharmacySystem);
             return(Ok());
         }
         return(BadRequest());
     }
     else
     {
         return(BadRequest());
     }
 }
 public IActionResult Create([FromBody] PharmacySystem pharmacySystem)
 {
     if (pharmacySystem.isValid())
     {
         _pharmacySystemService.CreatePharmacy(pharmacySystem);
         if (pharmacySystem.ActionsBenefitsSubscribed)
         {
             _actionBenefitService.Subscribe(pharmacySystem.ActionsBenefitsExchangeName);
         }
         return(CreatedAtRoute("get", pharmacySystem));
     }
     else
     {
         return(BadRequest());
     }
 }