public IEnumerable <Query.Document> Search(Query.Document.Specification specification)
        {
            Guard.AgainstNull(specification, nameof(specification));

            var result = _queryMapper.MapObjects <Query.Document>(_queryFactory.Search(specification))
                         .ToDictionary(document => document.Id);

            if (specification.StatusEventsIncluded && result.Any())
            {
                foreach (var mappedRow in _queryMapper.MapRows <Query.Document.StatusEvent>(_queryFactory.GetStatusEvents(result.Keys)))
                {
                    if (result.TryGetValue(Columns.DocumentId.MapFrom(mappedRow.Row), out var document))
                    {
                        document.StatusEvents.Add(mappedRow.Result);
                    }
                }
            }

            if (specification.PropertiesIncluded && result.Any())
            {
                foreach (var mappedRow in _queryMapper.MapRows <Query.Document.Property>(query: _queryFactory.GetProperties(result.Keys)))
                {
                    if (result.TryGetValue(Columns.DocumentId.MapFrom(mappedRow.Row), out var document))
                    {
                        document.Properties.Add(mappedRow.Result);
                    }
                }
            }

            return(result.Values);
        }