public async Task <IActionResult> UpdatePropertyType([FromBody] SavePropertyTypeResource resource, int id)
        {
            var propertyTypeToUpdate = await _propertyTypeService.FindPropertyTypeById(id);

            if (propertyTypeToUpdate == null)
            {
                return(NotFound(_response.Error("The property type does not exists")));
            }

            var propertyType = _mapper.Map <PropertyType>(resource);
            var result       = await _propertyTypeService.UpdatePropertyType(propertyTypeToUpdate, propertyType);

            var propertyTypeResource = _mapper.Map <PropertyTypeResource>(result);

            return(Ok(_response.Ok(propertyTypeResource)));
        }
        public async Task <IActionResult> CreatePropertyType([FromBody] SavePropertyTypeResource resource)
        {
            var propertyType = await _propertyTypeService.FindPropertyTypeByName(resource.Name);

            if (propertyType != null)
            {
                return(BadRequest(_response.Error("The property type already exists")));
            }

            propertyType = _mapper.Map <PropertyType>(resource);

            var result = await _propertyTypeService.CreatePropertyType(propertyType);

            var propertyTypeResource = _mapper.Map <PropertyTypeResource>(result);

            return(Ok(_response.Ok(propertyTypeResource)));
        }