public async Task <IActionResult> PutExternalMedia(int id, ExternalMedia externalMedia)
        {
            int idAgency = await _userService.GetAuthorizedAgencyId(this.User);

            if (id != externalMedia.Id)
            {
                return(BadRequest());
            }
            if (externalMedia.AgencyID != idAgency)
            {
                return(BadRequest(new { message = "resource is not yours" }));
            }

            _context.Entry(externalMedia).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ExternalMediaExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <ActionResult <ExternalMedia> > PostExternalMedia(ExternalMedia externalMedia)
        {
            int idAgency = await _userService.GetAuthorizedAgencyId(this.User);

            externalMedia.AgencyID = idAgency;

            _context.ExternalMedias.Add(externalMedia);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetExternalMedia", new { id = externalMedia.Id }, externalMedia));
        }