Often applications allow a user to specify inputs by providing the IDs, or unique names of items which can be found in the database. Using the user provided collection of items, you would query your data and hopefully return a collection with the same number of elements as what the user was searching for. In some cases though, not all the items the user provided will be found in the database. I recently wrote a generic helper method which provides warnings to the user for any "missing" elements (i.e. they asked for it in the source but it wasn't in the output).

public static class MissingItemsHelper
    {
        /// <summary>
        /// Will display a message to the user showing any items that existing in the itemsToFind collection that did not exist in the collectionToSearch (using the Equals operator)
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="itemsToFind">The collection containing the items which need to be checked against the other list</param>
        /// <param name="collectionToSearch">The collection which will be checked for the existance of each item</param>
        /// <param name="missingItemMessageTextSelector">For items that are missing, this selector function should return the text you want to output in the message for each item</param>
        /// <param name="messageNounText">The singular noun which identifies what you are currently searching</param>
        public static string GetWarningsIfItemsNotInCollection<T>(
            IEnumerable<T> itemsToFind,
            IEnumerable<T> collectionToSearch,
            Func<T, string> missingItemMessageTextSelector,
            string messageNounText)
        {
            //any missing items? - find those which dont have an equal in the target list
            IEnumerable<T> missingItems =
                (from sourceItem in itemsToFind
                 where collectionToSearch.Any((f) => f.Equals(sourceItem)) == false
                 select sourceItem);

            //if there were some missing items, show the message to the user with the missing items text
            if (missingItems.Count() > 0)
                    return string.Format("The following {0}s were not found:\r\n", messageNounText)
                                    + string.Join("\r\n",missingItems.Select(missingItemMessageTextSelector).ToArray());

            return string.Empty;
        }
    }
I've tried to keep it as generic as possible, which is why you must provide the type T of the elements and a function which selects the "missing" information as well as a noun which describes that information. For example:

MissingItemsHelper.GetWarningsIfItemsNotInCollection<long>(
                    inputIds, (from d in dataItems select d.UniqueId),
                    new Func<long, string>((id) => id.ToString()), "Unique ID");
This could be extended further to take various types with a comparison operator, but for simplicity I have kept to one type.