private function _translateRoles(
        $environmentInfo,
        RoleInstance $currentInstance,
        $currentRole
    ) {
        $rolesMap = [];

        $rolesInfo = Utilities::tryGetKeysChainValue(
            $environmentInfo,
            'Roles',
            'Role'
        );

        if (!is_null($rolesInfo)) {
            if (array_key_exists('@attributes', $rolesInfo)) {
                $rolesInfo = [0 => $rolesInfo];
            }

            foreach ($rolesInfo as $roleInfo) {
                $roleInstances = $this->_translateRoleInstances($roleInfo);

                if ($roleInfo['@attributes']['name'] == $currentRole) {
                    $roleInstances[$currentInstance->getId()] = $currentInstance;
                }

                $role = new Role($roleInfo['@attributes']['name'], $roleInstances);

                foreach ($roleInstances as $instance) {
                    $instance->setRole($role);
                }

                $rolesMap[$roleInfo['@attributes']['name']] = $role;
            }
        }

        if (!array_key_exists($currentRole, $rolesMap)) {
            $roleInstances = [];
            $roleInstances[$currentInstance->getId()] = $currentInstance;

            $singleRole = new Role($currentRole, $roleInstances);
            $currentInstance->setRole($singleRole);

            $rolesMap[$currentRole] = $singleRole;
        }

        return $rolesMap;
    }