ository = taskRepository;
        }

        public async Task&lt;ListResultDto&lt;TaskListDto&gt;&gt; GetAll(GetAllTasksInput input)
        {
            var tasks = await _taskRepository
                .GetAll()
                .WhereIf(input.State.HasValue, t =&gt; t.State == input.State.Value)
                .OrderByDescending(t =&gt; t.CreationTime)
                .ToListAsync();

            return new ListResultDto&lt;TaskListDto&gt;(
                ObjectMapper.Map&lt;List&lt;TaskListDto&gt;&gt