public static async Task CreateAssetTypeAsync(
            HttpClient client,
            string regulatoryTypeId,
            string id,
            string underlyingCategoryId,
            string assetTypeTemplateId = null)
        {
            var request = new AddAssetTypeRequest
            {
                RegulatoryTypeId    = regulatoryTypeId,
                Username            = "******",
                AssetTypeTemplateId = assetTypeTemplateId,
                Id = id,
                UnderlyingCategoryId = underlyingCategoryId,
            };

            await client.PostAsync($"/api/asset-types", request.ToJsonStringContent());
        }
        public async Task <ErrorCodeResponse <ClientProfilesErrorCodesContract> > AddAssetTypeAsync([FromBody] AddAssetTypeRequest request)
        {
            var response = new ErrorCodeResponse <ClientProfilesErrorCodesContract>();

            var correlationId = this.TryGetCorrelationId();

            try
            {
                var model = _convertService.Convert <AddAssetTypeRequest, AssetTypeWithTemplate>(request);
                await _assetTypesService.InsertAsync(model, request.Username,
                                                     correlationId);
            }
            catch (AssetTypeDoesNotExistException)
            {
                response.ErrorCode = ClientProfilesErrorCodesContract.AssetTypeDoesNotExist;
            }
            catch (AlreadyExistsException)
            {
                response.ErrorCode = ClientProfilesErrorCodesContract.AlreadyExist;
            }
            catch (BrokerSettingsDoNotExistException)
            {
                response.ErrorCode = ClientProfilesErrorCodesContract.BrokerSettingsDoNotExist;
            }
            catch (RegulatoryTypeDoesNotExistException)
            {
                response.ErrorCode = ClientProfilesErrorCodesContract.RegulatoryTypeInMdmIsMissing;
            }
            catch (RegulatorySettingsDoNotExistException)
            {
                response.ErrorCode = ClientProfilesErrorCodesContract.RegulatorySettingsAreMissing;
            }
            catch (RegulationConstraintViolationException)
            {
                response.ErrorCode = ClientProfilesErrorCodesContract.RegulationConstraintViolation;
            }
            catch (UnderlyingCategoryDoesNotExistException)
            {
                response.ErrorCode = ClientProfilesErrorCodesContract.UnderlyingCategoryDoesNotExist;
            }

            return(response);
        }