private static IEnumerable <string> GetAppliedVersions <TContext>()
            where TContext : DbContext, new()
        {
            using (var context = new TContext())
            {
                var connection = context.OpenConnection();

                try
                {
                    return(connection
                           .QueryDynamic(
                               @"SELECT MigrationVersion from PocketMigrator.AppliedMigrations")
                           .Single()
                           .Select(x => (string)x.MigrationVersion)
                           .ToArray());
                }
                catch (SqlException exception)
                {
                    if (exception.Number == 208) // AppliedMigrations table is not present
                    {
                        return(new string[0]);
                    }

                    throw;
                }
            }
        }