I'm working on load/save application sessions functionality, and came up with this code:public class SessionManager{    private static ISessionStorage storage = new DbTableSessionStorage();    private static StudySession session;    public static StudySession Current    {        get        {            if (session == null) {                throw new Exception(Load or start new session before using SessionManager.Current);            }            return session;        }    }    public static void LoadSession(int sessionId)    {        session = storage.LoadSession(sessionId);    }    public static void Save(StudySession session, int prefferedId = -1)    {        storage.SaveSession(session, prefferedId);    }}public class DbTableSessionStorage : ISessionStorage{    public void SaveSession(StudySession studySession, int prefferedId = -1)    {        Session session = DSDatabase.Context[USER].Read<Session>(prefferedId);        if (session == null) {            session = new Session();        }        if (prefferedId != -1) {            session.Id = prefferedId;        }        session.Name = studySession.Name;        session.Timestamp = studySession.Timestamp == DateTime.MinValue                                ? DateTime.Now                                 : studySession.Timestamp;        session.GroupId = studySession.GroupId;        session.TestId = studySession.TestId;        session.Position = studySession.Position;        session.SoundOn = studySession.SoundOn;        DSDatabase.Context[USER].Save(session);                }    public StudySession LoadSession(int id)    {        StudySession result = new StudySession();        Session session = DSDatabase.Context[USER].Read<Session>(id);        if (session != null) {            result.Id = session.Id.Value;            result.Name = session.Name;            result.Timestamp = session.Timestamp;            result.GroupId = session.GroupId;            result.TestId = session.TestId;            result.SoundOn = session.SoundOn;        }        return result;    }}I am using it in this way:public class Chapter {//....    public static Chapter[] GetChildren(int parentId)    {        string sqlQuery = baseSqlQuery + Environment.NewLine +                 WHERE CHAPTERS.GroupId=? AND CHAPTERS.ParentId=?;                        return DSDatabase.RunQuery<Chapter>(sqlQuery, SessionManager.Current.GroupId, parentId).ToArray();    }//....}It seems to me as not a very good solution, because my code becomes tightly coupled and hides the dependencies. I'm looking now for better solutions to this issue.
Load/Save application sessions
c#;object oriented;design patterns