/// <summary> /// Look up in <paramref name="repository"/> for the <see cref="CategoryDTO"/> by the <paramref name="id"/> key. /// If nothing found, null will be returned. /// </summary> /// <param name="id">Category unique ID.</param> /// <param name="repository">Repository to lookup in.</param> /// <returns>Found category instance or null otherwise.</returns> public static CategoryDTO LookupIn(this int?id, ICategoriesRepository repository) { return(id.HasValue ? repository.ByKey(id.Value) : null); }