public async Task <GraphInfo> GetLastYearClicksAsync(string linkId, string userId, DateTime first) { bool isLinkIdNull = (linkId == null); List <ClicksCount> clicks = await Clicks .Where(c => c.Link.OwnerId == userId) .Where(c => isLinkIdNull ? true : c.LinkId == linkId) .Where(c => c.DateTime > first) .GroupBy(c => (int)c.DateTime.Subtract(first).TotalDays) .Select(group => new ClicksCount { Time = group.Key, Count = group.Count() }) .ToListAsync(); return(GetGraphInfo(366, clicks, first, 2)); }