@Nullable
    public Table loadTable(@NotNull String name) {

		if(tableCache.containsKey(name)) {
			return tableCache.get(name);
		}
		
        int ignore = 0;
        int attributesCount = 0;
        int firstPage = 0;
        List<Attribute> attributes = null;
        for(Record rec: table) {
            Map<SecondLevelId, Object> recAtributes = rec.getAttributes();
            if(ignore != 0) {
                ignore -= 1;
                continue;
            }
            String currName = (String) recAtributes.get(NAME_ID);
            if(attributes != null) {
                attributesCount -= 1;
                Attribute.DataType type = integersToType(recAtributes);
                Attribute atr = new Attribute(currName, type);
                attributes.add(atr);
                if(attributesCount == 0) {
            		Map<Attribute, BxTree> indexes = loadIndexes(name, attributes);
                    Table result = new Table(bufferManager, firstPage, 
                    		attributes, name, indexes);
                    if(tableCache.size() == MAX_TABLE_CACHE_ITEMS) {
                    	tableCache.remove(tableCache.keySet().iterator().next());
                    }
                    tableCache.put(name, result);
                    return result;
                }
                continue;
            }
            if(!name .equals(currName)) {
                ignore = (Integer)recAtributes.get(VAL2_ID);
                continue;
            }
            attributes = new ArrayList<>();
            attributesCount = (Integer)recAtributes.get(VAL2_ID);
            firstPage = (Integer)recAtributes.get(VAL1_ID);
        }

        return null;
    }