class AssetGroupServiceImpl implements AssetGroupService {

	@Override
	public String createAssetGroupDetails(final CreateUpdateAssetGroupDetails createAssetGroupDetails, final String userId) throws PacManException {
		try {
			Map<String, Object> assetGroupAlias = createAliasForAssetGroup(createAssetGroupDetails);
			Response response = commonService.invokeAPI("POST", ALIASES, mapper.writeValueAsString(assetGroupAlias));
			if(response != null) {
				if (response.getStatusLine().getStatusCode() == 200) {
					return processCreateAssetGroupDetails(createAssetGroupDetails, assetGroupAlias, userId);
				} else {
					throw new PacManException(UNEXPECTED_ERROR_OCCURRED);
				}
			} else {
				throw new PacManException(UNEXPECTED_ERROR_OCCURRED);
			}
		} catch (Exception exception) {
			log.error(UNEXPECTED_ERROR_OCCURRED, exception);
			throw new PacManException(UNEXPECTED_ERROR_OCCURRED.concat(": ").concat(exception.getMessage()));
		}
	}

}