public async Task <MetadataCategoryResource> GetCategory(Guid uuid)
        {
            try {
                var category = await _metadataCategoryService.GetByUuidAsync(uuid);

                var res = _mapper.Map <MetadataCategory, MetadataCategoryResource>(category);
                return(res);
            } catch (Exception) {
                throw new HttpException(HttpStatusCode.NotFound);
            }
        }
        public async Task <IActionResult> PutAsync([FromBody] SaveMetadataTypeResource resource)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState.GetErrorMessages()));
            }

            var username = httpContextRetriever.HttpContext.User.Identity.Name;
            var user     = await userService.GetUserByMailAsync(username);

            if (user.UserType < UserType.Municipality)
            {
                return(Unauthorized("Invalid permission for creation of a new MetadataType"));
            }

            var metadataType = _mapper.Map <SaveMetadataTypeResource, MetadataType>(resource);
            var result       = await _metadataTypeService.SaveAsync(metadataType);

            //Make sure the metadata category knows it has a type
            var metadataCategory = await _metadataCategoryService.GetByUuidAsync(resource.CategoryUuid);

            metadataCategory.HasTypes = true;

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

            var res = _mapper.Map <MetadataType, MetadataTypeResource>(metadataType);

            await _unitOfWork.CompleteAsync();

            return(Ok(res));
        }