@Override
 public void updateRole(RoleDto role) {
   MotechRole motechRole = allMotechRoles.findByRoleName(role.getOriginalRoleName());
   motechRole.setRoleName(role.getRoleName());
   motechRole.setPermissionNames(role.getPermissionNames());
   List<MotechUser> users =
       (List<MotechUser>) allMotechUsers.findByRole(role.getOriginalRoleName());
   for (MotechUser user : users) {
     List<String> roleList = user.getRoles();
     roleList.remove(role.getOriginalRoleName());
     roleList.add(role.getRoleName());
     allMotechUsers.update(user);
   }
   allMotechRoles.update(motechRole);
 }
 @Override
 public void deleteRole(RoleDto role) {
   MotechRole motechRole = allMotechRoles.findByRoleName(role.getRoleName());
   allMotechRoles.remove(motechRole);
 }
 @Override
 public RoleDto getRole(String roleName) {
   MotechRole motechRole = allMotechRoles.findByRoleName(roleName);
   return motechRole != null ? new RoleDto(motechRole) : null;
 }