public static IApplicationProducerContract Get(string applicationName)
        {
            string owner = Container.GetAppContext().UserName;

            using (TurbineModelContainer container = new TurbineModelContainer())
            {
                var user = container.Users.Single <User>(s => s.Name == owner);
                var obj  = container.Applications.
                           SingleOrDefault <Application>(s => s.Name == applicationName);
                if (obj == null)
                {
                    return(null);
                }
            }
            var contract = new ApplicationProducerContract();

            contract.applicationName = applicationName;
            return(contract);
        }
        public static IApplicationProducerContract Create(string applicationName, string version)
        {
            string owner = Container.GetAppContext().UserName;

            using (TurbineModelContainer container = new TurbineModelContainer())
            {
                var user = container.Users.Single <User>(s => s.Name == owner);
                var obj  = container.Applications.SingleOrDefault <Application>(s => s.Name == applicationName);
                if (obj != null)
                {
                    throw new InvalidStateChangeException(String.Format("Application with Name {0} already exists", applicationName));
                }

                container.Applications.AddObject(new Application()
                {
                    Name = applicationName, User = user, Version = version
                });
                container.SaveChanges();
            }
            var contract = new ApplicationProducerContract();

            contract.applicationName = applicationName;
            return(contract);
        }