public async Task<PagedResult<LinkDTO>> GetLinks(int userId, int page = 1, int pageSize = 30) {
            PagedResult<ShortenedLink> shortenedLinksPagedResult = new PagedResult<ShortenedLink>();
            PagedResult<LinkDTO> linksDtoPagedResult = new PagedResult<LinkDTO>();
            linksDtoPagedResult.Results = new List<LinkDTO>();

            var existingUser = await _usersRepository.Get(userId);
            if (existingUser != null) {
                shortenedLinksPagedResult = await _shortenedLinksRepository.GetPagedResultByQuery(page, pageSize,
                    sl => sl.User.Id == existingUser.Id, sl => sl.Created, true);

                foreach (var shortenLink in shortenedLinksPagedResult.Results) {
                    var linkDto = new LinkDTO() {
                        CreatedDate = shortenLink.Created?.ToShortDateString(),
                        CreatedTime = shortenLink.Created?.ToShortTimeString(),
                        FullLink = shortenLink.FullLink,
                        ShortLink = ShortLinkCreator.CreateShortLink(Request.RequestUri, shortenLink.ShortLink),
                        VisitsCount = shortenLink.VisitCount
                    };
                    linksDtoPagedResult.Results.Add(linkDto);
                }

                linksDtoPagedResult.TotalCount = shortenedLinksPagedResult.TotalCount;
                linksDtoPagedResult.CurrentPage = shortenedLinksPagedResult.CurrentPage;
                linksDtoPagedResult.PageCount = shortenedLinksPagedResult.PageCount;
                linksDtoPagedResult.PageSize = shortenedLinksPagedResult.PageSize;
            }

            return linksDtoPagedResult;
        }
        public async Task<LinkDTO> CreateLink(LinkDTO linkDTO) {
            var link = new ShortenedLink {
                FullLink = linkDTO.FullLink
            };

            var existingUser = await _usersRepository.Get(linkDTO.UserId);
            if (existingUser != null) {
                link.User = existingUser;
            }

            var id = await _linksRepository.Insert(link);
            var translatedId = Base36.Encode(id);
            link.ShortLink = translatedId;
            await _linksRepository.Update(link);

            linkDTO.ShortLink = ShortLinkCreator.CreateShortLink(Request.RequestUri, translatedId);

            return linkDTO;
        }