public long AddChirp(Domain.Model.Chirp chirp)
 {
     using (ChirpyRDataContext context =
         new ChirpyRDataContext(_connectionName, _schemaName))
     {
         Data.Model.Chirp replyChirp =
             chirp.InReplyTo != null ?
             context.Chirps.Find(chirp.InReplyTo.Id) :
             null;
         Data.Model.ChirpyRUser chirpUser =
             chirp.ChirpBy != null ?
             context.ChirpyRUsers.Find(chirp.ChirpBy.Id) :
             null;
         Data.Model.Chirp newChirp = new Model.Chirp();
         newChirp.LoadFromDomainEntity(chirp);
         context.Entry<Data.Model.Chirp>(newChirp).State =
             System.Data.EntityState.Added;
         context.SaveChanges();
         return newChirp.Id;
     }
 }
        public long AddChirp(Domain.Model.Chirp chirp)
        {
            using (ChirpyRDataContext context =
                       new ChirpyRDataContext(_connectionName, _schemaName))
            {
                Data.Model.Chirp replyChirp =
                    chirp.InReplyTo != null?
                    context.Chirps.Find(chirp.InReplyTo.Id) :
                        null;

                Data.Model.ChirpyRUser chirpUser =
                    chirp.ChirpBy != null?
                    context.ChirpyRUsers.Find(chirp.ChirpBy.Id) :
                        null;

                Data.Model.Chirp newChirp = new Model.Chirp();
                newChirp.LoadFromDomainEntity(chirp);
                context.Entry <Data.Model.Chirp>(newChirp).State =
                    System.Data.EntityState.Added;
                context.SaveChanges();
                return(newChirp.Id);
            }
        }