try {
GatewayProfileResource profileResource = new GatewayProfileResource();
profileResource.setGatewayName(gatewayProfile.getGatewayName());
profileResource.setGatewayID(AppCatalogUtils.getID(gatewayProfile.getGatewayName()));
profileResource.setGatewayDesc(gatewayProfile.getGatewayDescription());
profileResource.save();
gatewayProfile.setGatewayID(profileResource.getGatewayID());
List<ComputeResourcePreference> computeResourcePreferences = gatewayProfile.getComputeResourcePreferences();
if (computeResourcePreferences != null && !computeResourcePreferences.isEmpty()){
for (ComputeResourcePreference preference : computeResourcePreferences ){
ComputeHostPreferenceResource resource = new ComputeHostPreferenceResource();