public Data_Access_Layer.City GetOrCreateCity(Common.DTO.City model) { Data_Access_Layer.City city = null; if (model.Id != 0) { city = _sqliteConnection .Find <Data_Access_Layer.City>(model.Id); return(city); } city = _sqliteConnection .Table <Data_Access_Layer.City>() .FirstOrDefault(ci => ci.Name == model.Name); if (city == null) { city = new Data_Access_Layer.City { Name = model.Name }; _sqliteConnection.Insert(city); } return(city); }