/// <summary> /// If the images collection contains the given imageName Key, the Value is cast to the Entity type T, else null is returned /// </summary> /// <typeparam name="T"></typeparam> /// <param name="images"></param> /// <param name="imageName"></param> /// <returns></returns> private T GetEntity <T>(DataCollection <string, Entity> images, string imageName) where T : Entity { T entity = null; if (!images.ContainsKey(imageName)) { return(null); } try { entity = (images[imageName]).ToEntity <T>(); } catch (Exception ex) { LogException(ex); } return(entity); }