public static Model loadModel(LibraryModel lmodel)
  {
    try
    {    
      File file = lmodel.file;
      
      if (file.exists())
      {
        JsonModel jmodel = FileUtils.readJson(file, JsonModel.class);
        
        Model model = new Model(lmodel);
        model.allocateLevels(jmodel.info.levels+1);
        
        JsonPiece[][] pieces = jmodel.pieces;
        
        for (int i = 0; i < pieces.length; ++i)
        {
          JsonPiece[] level = pieces[i];
          for (int j = 0; j < level.length; ++j)
          {
            JsonPiece piece = level[j];
            model.addPiece(model.levelAt(i), PieceType.forName(piece.type), PieceColor.forName(piece.color), piece.x, piece.y);
          }
        }
        
        return model;
      }
      else
        return null;
    }
    catch (Exception e)
    {
      e.printStackTrace();
    }
    
    return null;
  }