def _validate_build_resource_structure(autoload_resource):
        """Validate resource structure

        :param dict autoload_resource:
        :return correct autoload resource structure
        :rtype: dict
        """
        result = {}

        for resource_prefix, resources in autoload_resource.iteritems():

            max_free_index = max(map(int, resources)) + 1 or 1

            for index, sub_resources in resources.iteritems():
                if not index or index == -1:
                    index = max_free_index
                    max_free_index += 1

                if len(sub_resources) > 1:
                    result["{0}{1}".format(resource_prefix, index)] = sub_resources[0]
                    for resource in sub_resources[1:]:
                        result["{0}{1}".format(resource_prefix, str(max_free_index))] = resource
                        max_free_index += 1
                else:
                    result["{0}{1}".format(resource_prefix, index)] = sub_resources[0]

        return result
Validate resource structure

        :param dict autoload_resource:
        :return correct autoload resource structure
        :rtype: dict