protected virtual Expected <T> GetEntityById(K id) { var entityService = _service; var entity = entityService.GetById(id); if (entity == default(T)) { return(Expected <T> .ErrorFormat(DALErrorCode.EntityNotFound, "{0} with id '{1}' was not found.", typeof(T).Name, id)); } return(entity); }