private static List <int> SaveTokensWithPosition(string tokensPath, IEnumerable <TokenBase> tokens) { var list = new List <int>(); using (var file = FileStorage.Instance.GetFile(tokensPath)) { using (file.Lock()) { foreach (var baseToken in tokens) { list.Add(file.Position); TokenSerializer.Save(file.Writer, baseToken); } } } return(list); }