public async Task <IEnumerable <Form> > GetByNameAsync(string name) { CreateUpdateActions(); var existingEntitiesMatchingCondition = Current.Where(p => p.Entity.Name == name).Select(p => p.Entity).ToList(); string getByNameSqlQuery = _sqlGenerator.BuildGetByNameSqlQuery(typeof(Form).Name); IEnumerable <Form> resultsFromDataBase = await _connection.QueryAsync <Form>(getByNameSqlQuery, new { Name = name, ExcludedIds = existingEntitiesMatchingCondition.Select(p => p.Id).ToArray() }).ConfigureAwait(false); existingEntitiesMatchingCondition.AddRange(resultsFromDataBase); IEnumerable <CleanEntity <Form> > propertiesDictionaries = from entity in resultsFromDataBase let cleanEntity = _dataComparer.ConvertObjectToPropertiesDictionary(entity) select new CleanEntity <Form>(entity, cleanEntity); Current.AddRange(propertiesDictionaries); return(existingEntitiesMatchingCondition); }