public async Task <ActionResult <PrimaryItemResource> > Update(long id, [FromBody] PrimaryItemSaveResource resourceToSave)
        {
            var cacheKey      = $"{nameof(PrimaryItemResource)}_{id}";
            var modelToUpdate = await _service.GetById(id);

            if (modelToUpdate == null)
            {
                return(NotFound());
            }

            var model = _mapper.Map <PrimaryItemSaveResource, PrimaryItem>(resourceToSave);

            try
            {
                await _service.Update(modelToUpdate, model);

                var resource = _mapper.Map <PrimaryItem, PrimaryItemResource>(modelToUpdate);
                await _cache.AddAsync(cacheKey, resource);

                return(Ok(resource));
            }
            catch (ArgumentNotFoundException exception)
            {
                return(BadRequest(exception.ArgumentName));
            }
            catch (ArgumentNotUniqueException exception)
            {
                return(Conflict(exception.ArgumentName));
            }
        }
        public async Task <ActionResult <PrimaryItemResource> > Create([FromBody] PrimaryItemSaveResource resourceToSave, ApiVersion apiVersion)
        {
            try
            {
                var model = _mapper.Map <PrimaryItemSaveResource, PrimaryItem>(resourceToSave);
                model = await _service.Create(model);

                var resource = _mapper.Map <PrimaryItem, PrimaryItemResource>(model);
                return(CreatedAtAction(nameof(Get), new { id = 1, apiVersion = apiVersion.ToString() }, resource));
            }
            catch (ArgumentNotUniqueException exception)
            {
                return(Conflict(exception.ArgumentName));
            }
            catch (ArgumentNotFoundException exception)
            {
                return(BadRequest(exception.ArgumentName));
            }
        }