//based on the type fields prensent in the broker, call the right repository method public ICollection <BrokerModel> GetInfo(BrokerQueryModel entity) { if (entity.FirstName != null && entity.LastName != null) { return(_repository.GetByName(entity.FirstName, entity.LastName)); } else if (entity.Email != null) { return(_repository.GetByEmail(entity.Email)); } else if (entity.Expertise != null) { return(_repository.GetByExpertise(entity.Expertise)); } return(new List <BrokerModel>()); }