Family pet losing my mind

I have an 8 year old beagle.  We have had her since she was a puppy but I can't handle her anymore.  I am pregnant with our second child and I am seriously in my last nerve with her.  Every time we leave our apartment she barks for an hour straight non stop and she will go to the bathroom inside so we started to crate her because nothing else was working and she still barks uncontrollably...I honestly am at the point where I dont want her anymore.  I am generally a really happy person but over the past 2 years I find myself becoming angry and stressed.  I lose my temper and yell in front of my child and this is NOT me! I don't know what the heck to do! Please give me advice I feel so desperate.