Index: modules/dnet-openaire-users/branches/prod/src/main/java/eu/dnetlib/openaire/usermanagement/utils/HttpUtils.java
===================================================================
--- modules/dnet-openaire-users/branches/prod/src/main/java/eu/dnetlib/openaire/usermanagement/utils/HttpUtils.java	(revision 61373)
+++ modules/dnet-openaire-users/branches/prod/src/main/java/eu/dnetlib/openaire/usermanagement/utils/HttpUtils.java	(revision 61374)
@@ -33,7 +33,7 @@
         headers.setContentType(MediaType.APPLICATION_JSON);
         HttpEntity<String> request = new HttpEntity<>(body.toString(), headers);
         ResponseEntity<String> responseEntity = restTemplate.exchange(issuer + path, HttpMethod.POST, request, String.class);
-        if(responseEntity.getBody() != null) {
+        if (responseEntity.getBody() != null) {
             return new JsonParser().parse(responseEntity.getBody());
         } else {
             return null;
@@ -46,7 +46,7 @@
         headers.setContentType(MediaType.APPLICATION_JSON);
         HttpEntity<String> request = new HttpEntity<>(body.toString(), headers);
         ResponseEntity<String> responseEntity = restTemplate.exchange(issuer + path, HttpMethod.PUT, request, String.class);
-        if(responseEntity.getBody() != null) {
+        if (responseEntity.getBody() != null) {
             return new JsonParser().parse(responseEntity.getBody());
         } else {
             return null;
@@ -58,7 +58,7 @@
         String url = issuer + path + ((params != null) ? createParams(params) : null);
         ResponseEntity<String> responseEntity = restTemplate.exchange
                 (url, HttpMethod.GET, new HttpEntity<>(createHeaders(user, password)), String.class);
-        if(responseEntity.getBody() != null) {
+        if (responseEntity.getBody() != null) {
             return new JsonParser().parse(responseEntity.getBody());
         } else {
             return null;
@@ -70,7 +70,7 @@
         String url = issuer + path;
         ResponseEntity<String> responseEntity = restTemplate.exchange
                 (url, HttpMethod.DELETE, new HttpEntity<>(createHeaders(user, password)), String.class);
-        if(responseEntity.getBody() != null) {
+        if (responseEntity.getBody() != null) {
             return new JsonParser().parse(responseEntity.getBody());
         } else {
             return null;
@@ -82,7 +82,8 @@
         StringBuilder ret = new StringBuilder("?");
         int count = 0;
         for (Map.Entry<String, String> param : params.entrySet()) {
-            ret.append(param.getKey()).append("=").append(param.getValue());
+            ret.append(param.getKey()).append("=");
+            ret.append(param.getValue());
             count++;
             if (count != params.entrySet().size()) {
                 ret.append("&");
Index: modules/dnet-openaire-users/branches/prod/src/main/java/eu/dnetlib/openaire/usermanagement/utils/RegistryCalls.java
===================================================================
--- modules/dnet-openaire-users/branches/prod/src/main/java/eu/dnetlib/openaire/usermanagement/utils/RegistryCalls.java	(revision 61373)
+++ modules/dnet-openaire-users/branches/prod/src/main/java/eu/dnetlib/openaire/usermanagement/utils/RegistryCalls.java	(revision 61374)
@@ -115,60 +115,61 @@
     }
 
     /**
-     * 3. Get all OpenAIRE cous
+     * 3.1 Get OpenAIRE cous with a specific name(or substring)
      */
-    public JsonArray getCous() {
+    public JsonArray getCous(String name) {
         Map<String, String> params = new HashMap<>();
         params.put("coid", coid);
+        if(name != null) {
+            params.put("name", name.toLowerCase());
+        }
         JsonElement response = httpUtils.get("cous.json", params);
         return (response != null) ? response.getAsJsonObject().get("Cous").getAsJsonArray() : new JsonArray();
     }
 
     /**
-     * 4. Get a couId by name
+     * 3.2 Get all OpenAIRE cous
+     */
+    public JsonArray getCous() {
+        return getCous(null);
+    }
+
+    /**
+     * 4.1 Get a couId by name
      *
      * @param name
      * @return
      */
     public Integer getCouId(String name) {
-        JsonArray cous = getCous();
-        Integer couId = null;
+        JsonArray cous = getCous(name);
         for (JsonElement cou : cous) {
-            if (cou.getAsJsonObject().get("Name").getAsString().equals(name)) {
-                couId = cou.getAsJsonObject().get("Id").getAsInt();
+            if (cou.getAsJsonObject().get("Name").getAsString().toLowerCase().equals(name.toLowerCase())) {
+                return cou.getAsJsonObject().get("Id").getAsInt();
             }
         }
-        return couId;
+        return null;
     }
 
     /**
-     * 4. Get a couId by type.id
+     * 4.2 Get a couId by type.id with/without mapping type
      *
      * @param type
      * @param id
      * @return
      */
-    public Integer getCouId(String type, String id) {
-        return getCouId(type, id, true);
+    public Integer getCouId(String type, String id, boolean communityMap) {
+        return getCouId(mapType(type, communityMap) + "." + id);
     }
 
-
     /**
-     * 4. Get a couId by type.id without mapping type
+     * 4.3 Get a couId by type.id with mapping type
      *
      * @param type
      * @param id
      * @return
      */
-    public Integer getCouId(String type, String id, boolean communityMap) {
-        JsonArray cous = getCous();
-        Integer couId = null;
-        for (JsonElement cou : cous) {
-            if (cou.getAsJsonObject().get("Name").getAsString().equals(mapType(type, communityMap) + "." + id)) {
-                couId = cou.getAsJsonObject().get("Id").getAsInt();
-            }
-        }
-        return couId;
+    public Integer getCouId(String type, String id) {
+        return getCouId(type, id, true);
     }
 
     /**
@@ -354,8 +355,9 @@
     /**
      * 17. Create a new role
      */
-    public void createRole(Role role) {
-        httpUtils.post("cous.json", jsonUtils.createNewCou(role));
+    public Integer createRole(Role role) {
+        JsonElement element = httpUtils.post("cous.json", jsonUtils.createNewCou(role));
+        return element.getAsJsonObject().get("Id").getAsInt();
     }
 
     /**
Index: modules/dnet-openaire-users/branches/prod/src/main/java/eu/dnetlib/openaire/usermanagement/api/RegistryService.java
===================================================================
--- modules/dnet-openaire-users/branches/prod/src/main/java/eu/dnetlib/openaire/usermanagement/api/RegistryService.java	(revision 61373)
+++ modules/dnet-openaire-users/branches/prod/src/main/java/eu/dnetlib/openaire/usermanagement/api/RegistryService.java	(revision 61374)
@@ -12,13 +12,11 @@
 import eu.dnetlib.openaire.usermanagement.utils.RegistryCalls;
 import eu.dnetlib.openaire.usermanagement.utils.VerificationUtils;
 import org.apache.log4j.Logger;
-import org.mitre.openid.connect.model.OIDCAuthenticationToken;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
 import org.springframework.security.access.method.P;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.security.core.authority.SimpleGrantedAuthority;
-import org.springframework.security.core.context.SecurityContextHolder;
 import org.springframework.stereotype.Component;
 import org.springframework.web.bind.annotation.RequestBody;
 
@@ -118,8 +116,11 @@
     @PreAuthorize("hasAnyAuthority(@AuthorizationService.PORTAL_ADMIN)")
     public Response createRole(@RequestBody Role role) {
         if (calls.getCouId(role.getName()) == null) {
-            calls.createRole(role);
-            return Response.status(HttpStatus.OK.value()).entity(jsonUtils.createResponse("Role has been created").toString()).type(MediaType.APPLICATION_JSON).build();
+            if(calls.createRole(role) != null) {
+                return Response.status(HttpStatus.OK.value()).entity(jsonUtils.createResponse("Role has been created").toString()).type(MediaType.APPLICATION_JSON).build();
+            } else {
+                return Response.status(HttpStatus.BAD_REQUEST.value()).entity(jsonUtils.createResponse("An error has occurred. Please try again later").toString()).type(MediaType.APPLICATION_JSON).build();
+            }
         } else {
             return Response.status(HttpStatus.CONFLICT.value()).entity(jsonUtils.createResponse("Role has already existed").toString()).type(MediaType.APPLICATION_JSON).build();
         }
Index: modules/dnet-openaire-users/branches/prod/pom.xml
===================================================================
--- modules/dnet-openaire-users/branches/prod/pom.xml	(revision 61373)
+++ modules/dnet-openaire-users/branches/prod/pom.xml	(revision 61374)
@@ -25,7 +25,7 @@
         <dependency>
             <groupId>eu.dnetlib</groupId>
             <artifactId>uoa-login-core</artifactId>
-	    <version>1.0.0</version>
+            <version>1.0.2</version>
         </dependency>
         <dependency>
             <groupId>org.slf4j</groupId>
